!function(){return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[a]={exports:{}};t[a][0].call(f.exports,function(e){return i(t[a][1][e]||e)},f,f.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a=i&&o>=a?(r=e[0],t=e[1],n=e[2]):a>=o&&a>=i?(r=e[1],t=e[0],n=e[2]):(r=e[2],t=e[0],n=e[1]),this.crossProductZ(t,r,n)<0){var s=t;t=n,n=s}e[0]=t,e[1]=r,e[2]=n},e.distance=function(e,t){return n.default.distance(e.x,e.y,t.x,t.y)},e.crossProductZ=function(e,t,r){var n=t.x,i=t.y;return(r.x-n)*(e.y-i)-(r.y-i)*(e.x-n)},e}();t.default=o},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(5).default);t.default=o},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(t){void 0===t&&(t=void 0);var r=e.call(this,t)||this;return r.message=t,r}return i(t,e),t}(r(102).CustomError);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),i=r(7),o=r(41),a=r(12),s=r(1),u=function(){function e(e,t,r,n){if(this.width=e,this.height=t,this.rowSize=r,this.bits=n,null!=t||(t=e),this.height=t,e<1||t<1)throw new s.default("Both dimensions must be greater than 0");null!=r||(r=Math.floor((e+31)/32)),this.rowSize=r,null!=n||(this.bits=new Int32Array(this.rowSize*this.height))}return e.parseFromBooleanArray=function(t){for(var r=t.length,n=t[0].length,i=new e(n,r),o=0;oa){if(-1===u)u=o-a;else if(o-a!==u)throw new s.default("row lengths do not match");a=o,c++}f++}else if(t.substring(f,f+r.length)===r)f+=r.length,i[o]=!0,o++;else{if(t.substring(f,f+n.length)!==n)throw new s.default("illegal character encountered: "+t.substring(f));f+=n.length,i[o]=!1,o++}if(o>a){if(-1===u)u=o-a;else if(o-a!==u)throw new s.default("row lengths do not match");c++}for(var l=new e(u,c),d=0;d>>(31&e)&1)},e.prototype.set=function(e,t){var r=t*this.rowSize+Math.floor(e/32);this.bits[r]|=1<<(31&e)&4294967295},e.prototype.unset=function(e,t){var r=t*this.rowSize+Math.floor(e/32);this.bits[r]&=~(1<<(31&e)&4294967295)},e.prototype.flip=function(e,t){var r=t*this.rowSize+Math.floor(e/32);this.bits[r]^=1<<(31&e)&4294967295},e.prototype.xor=function(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new s.default("input matrix dimensions do not match");for(var t=new n.default(Math.floor(this.width/32)+1),r=this.rowSize,i=this.bits,o=0,a=this.height;othis.height||i>this.width)throw new s.default("The region must fit inside the matrix");for(var a=this.rowSize,u=this.bits,c=t;cs&&(s=u),32*ca){for(l=31;f>>>l==0;)l--;32*c+l>a&&(a=32*c+l)}}}return a=0&&0===t[r];)r--;if(r<0)return null;for(var n=Math.floor(r/e),i=32*Math.floor(r%e),o=t[r],a=31;o>>>a==0;)a--;return i+=a,Int32Array.from([i,n])},e.prototype.getWidth=function(){return this.width},e.prototype.getHeight=function(){return this.height},e.prototype.getRowSize=function(){return this.rowSize},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;return this.width===r.width&&this.height===r.height&&this.rowSize===r.rowSize&&o.default.equals(this.bits,r.bits)},e.prototype.hashCode=function(){var e=this.width;return 31*(e=31*(e=31*(e=31*e+this.width)+this.height)+this.rowSize)+o.default.hashCode(this.bits)},e.prototype.toString=function(e,t,r){return void 0===e&&(e="x"),void 0===t&&(t=" "),void 0===r&&(r="\n"),this.buildToString(e,t,r)},e.prototype.buildToString=function(e,t,r){var n=new a.default;n.append(r);for(var i=0,o=this.height;i0){var r=new n.default[t.length+e.length];i.default.arraycopy(t,0,r,0,t.length),i.default.arraycopy(e,0,r,t.length,e.length),this.resultPoints=r}},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.toString=function(){return this.text},e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),i=r(10),o=r(3),a=r(0),s=function(){function e(){}return e.prototype.decode=function(e,t){try{return this.doDecode(e,t)}catch(d){if(t&&!0===t.get(3)&&e.isRotateSupported()){var r=e.rotateCounterClockwise(),n=this.doDecode(r,t),s=n.getResultMetadata(),u=270;null!==s&&!0===s.get(i.default.ORIENTATION)&&(u+=s.get(i.default.ORIENTATION)%360),n.putMetadata(i.default.ORIENTATION,u);var c=n.getResultPoints();if(null!==c)for(var f=r.getHeight(),l=0;l>(f?8:5));r=f?u:15;for(var d=Math.trunc(u/2),h=0;h=u)break;try{c=e.getBlackRow(v,c)}catch(e){continue}for(var g=function(e){if(1===e&&(c.reverse(),t&&!0===t.get(9))){var r=new Map;t.forEach(function(e,t){return r.set(t,e)}),r.delete(9),t=r}try{var n=m.decodeRow(v,c,t);if(1===e){n.putMetadata(i.default.ORIENTATION,180);var a=n.getResultPoints();null!==a&&(a[0]=new o.default(s-a[0].getX()-1,a[0].getY()),a[1]=new o.default(s-a[1].getX()-1,a[1].getY()))}return{value:n}}catch(e){}},m=this,y=0;y<2;y++){var _=g(y);if("object"==typeof _)return _.value}}throw new a.default},e.recordPattern=function(e,t,r){for(var n=r.length,i=0;i=o)throw new a.default;for(var s=!e.get(t),u=0,c=t;c0&&i>=0;)t.get(--r)!==o&&(i--,o=!o);if(i>=0)throw new a.default;e.recordPattern(t,r+1,n)},e.patternMatchVariance=function(e,t,r){for(var n=e.length,i=0,o=0,a=0;al?f-l:l-f;if(d>r)return Number.POSITIVE_INFINITY;u+=d}return u/i},e}();t.default=s},function(e,t,r){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.OTHER=0]="OTHER",e[e.ORIENTATION=1]="ORIENTATION",e[e.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",e[e.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",e[e.ISSUE_NUMBER=4]="ISSUE_NUMBER",e[e.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",e[e.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",e[e.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",e[e.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",e[e.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",e[e.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(n||(n={})),t.default=n},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(5).default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){void 0===e&&(e=""),this.value=e}return e.prototype.append=function(e){return this.value+="string"==typeof e?e.toString():String.fromCharCode(e),this},e.prototype.length=function(){return this.value.length},e.prototype.charAt=function(e){return this.value.charAt(e)},e.prototype.deleteCharAt=function(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)},e.prototype.setCharAt=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)},e.prototype.toString=function(){return this.value},e.prototype.insert=function(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23),i=r(24),o=r(1),a=r(59),s=function(){function e(e,t,r){this.primitive=e,this.size=t,this.generatorBase=r;for(var i=new Int32Array(t),o=1,a=0;a=t&&(o^=e,o&=t-1);this.expTable=i;var s=new Int32Array(t);for(a=0;a32*this.bits.length){var r=e.makeArray(t);n.default.arraycopy(this.bits,0,r,0,this.bits.length),this.bits=r}},e.prototype.get=function(e){return 0!=(this.bits[Math.floor(e/32)]&1<<(31&e))},e.prototype.set=function(e){this.bits[Math.floor(e/32)]|=1<<(31&e)},e.prototype.flip=function(e){this.bits[Math.floor(e/32)]^=1<<(31&e)},e.prototype.getNextSet=function(e){var t=this.size;if(e>=t)return t;var r=this.bits,n=Math.floor(e/32),o=r[n];o&=~((1<<(31&e))-1);for(var a=r.length;0===o;){if(++n===a)return t;o=r[n]}var s=32*n+i.default.numberOfTrailingZeros(o);return s>t?t:s},e.prototype.getNextUnset=function(e){var t=this.size;if(e>=t)return t;var r=this.bits,n=Math.floor(e/32),o=~r[n];o&=~((1<<(31&e))-1);for(var a=r.length;0===o;){if(++n===a)return t;o=~r[n]}var s=32*n+i.default.numberOfTrailingZeros(o);return s>t?t:s},e.prototype.setBulk=function(e,t){this.bits[Math.floor(e/32)]=t},e.prototype.setRange=function(e,t){if(tthis.size)throw new a.default;if(t!==e){t--;for(var r=Math.floor(e/32),n=Math.floor(t/32),i=this.bits,o=r;o<=n;o++){var s=(2<<(or?0:31&e));i[o]|=s}}},e.prototype.clear=function(){for(var e=this.bits.length,t=this.bits,r=0;rthis.size)throw new a.default;if(t===e)return!0;t--;for(var n=Math.floor(e/32),i=Math.floor(t/32),o=this.bits,s=n;s<=i;s++){var u=(2<<(sn?0:31&e))&4294967295;if((o[s]&u)!==(r?u:0))return!1}return!0},e.prototype.appendBit=function(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++},e.prototype.appendBits=function(e,t){if(t<0||t>32)throw new a.default("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t),this.appendBit;for(var r=t;r>0;r--)this.appendBit(1==(e>>r-1&1))},e.prototype.appendBitArray=function(e){var t=e.size;this.ensureCapacity(this.size+t),this.appendBit;for(var r=0;r>1&1431655765|(1431655765&o)<<1)>>2&858993459|(858993459&o)<<2)>>4&252645135|(252645135&o)<<4)>>8&16711935|(16711935&o)<<8)>>16&65535|(65535&o)<<16,e[t-i]=o}if(this.size!==32*r){var a=32*r-this.size,s=e[0]>>>a;for(i=1;i>>a}e[r-1]=s}this.bits=e},e.makeArray=function(e){return new Int32Array(Math.floor((e+31)/32))},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;return this.size===r.size&&o.default.equals(this.bits,r.bits)},e.prototype.hashCode=function(){return 31*this.size+o.default.hashCode(this.bits)},e.prototype.toString=function(){for(var e="",t=0,r=this.size;t=900)throw new n.default("incorect value");var r=e.VALUES_TO_ECI.get(t);if(void 0===r)throw new n.default("incorect value");return r},e.getCharacterSetECIByName=function(t){var r=e.NAME_TO_ECI.get(t);if(void 0===r)throw new n.default("incorect value");return r},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;return this.getName()===r.getName()},e.VALUE_IDENTIFIER_TO_ECI=new Map,e.VALUES_TO_ECI=new Map,e.NAME_TO_ECI=new Map,e.Cp437=new e(0,Int32Array.from([0,2]),"Cp437"),e.ISO8859_1=new e(1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),e.ISO8859_2=new e(2,4,"ISO-8859-2","ISO88592","ISO8859_2"),e.ISO8859_3=new e(3,5,"ISO-8859-3","ISO88593","ISO8859_3"),e.ISO8859_4=new e(4,6,"ISO-8859-4","ISO88594","ISO8859_4"),e.ISO8859_5=new e(5,7,"ISO-8859-5","ISO88595","ISO8859_5"),e.ISO8859_6=new e(6,8,"ISO-8859-6","ISO88596","ISO8859_6"),e.ISO8859_7=new e(7,9,"ISO-8859-7","ISO88597","ISO8859_7"),e.ISO8859_8=new e(8,10,"ISO-8859-8","ISO88598","ISO8859_8"),e.ISO8859_9=new e(9,11,"ISO-8859-9","ISO88599","ISO8859_9"),e.ISO8859_10=new e(10,12,"ISO-8859-10","ISO885910","ISO8859_10"),e.ISO8859_11=new e(11,13,"ISO-8859-11","ISO885911","ISO8859_11"),e.ISO8859_13=new e(12,15,"ISO-8859-13","ISO885913","ISO8859_13"),e.ISO8859_14=new e(13,16,"ISO-8859-14","ISO885914","ISO8859_14"),e.ISO8859_15=new e(14,17,"ISO-8859-15","ISO885915","ISO8859_15"),e.ISO8859_16=new e(15,18,"ISO-8859-16","ISO885916","ISO8859_16"),e.SJIS=new e(16,20,"SJIS","Shift_JIS"),e.Cp1250=new e(17,21,"Cp1250","windows-1250"),e.Cp1251=new e(18,22,"Cp1251","windows-1251"),e.Cp1252=new e(19,23,"Cp1252","windows-1252"),e.Cp1256=new e(20,24,"Cp1256","windows-1256"),e.UnicodeBigUnmarked=new e(21,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),e.UTF8=new e(22,26,"UTF8","UTF-8"),e.ASCII=new e(23,Int32Array.from([27,170]),"ASCII","US-ASCII"),e.Big5=new e(24,28,"Big5"),e.GB18030=new e(25,29,"GB18030","GB2312","EUC_CN","GBK"),e.EUC_KR=new e(26,30,"EUC_KR","EUC-KR"),e}();t.default=i},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(5).default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.MathUtils=function(){},e.round=function(e){return NaN===e?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0},e.distance=function(e,t,r,n){var i=e-r,o=t-n;return Math.sqrt(i*i+o*o)},e.sum=function(e){for(var t=0,r=0,n=e.length;r!==n;r++)t+=e[r];return t},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(12),i=r(42),o=function(){function e(e,t){this.width=e,this.height=t}return e.prototype.getWidth=function(){return this.width},e.prototype.getHeight=function(){return this.height},e.prototype.isCropSupported=function(){return!1},e.prototype.crop=function(e,t,r,n){throw new i.default("This luminance source does not support cropping.")},e.prototype.isRotateSupported=function(){return!1},e.prototype.rotateCounterClockwise=function(){throw new i.default("This luminance source does not support rotation by 90 degrees.")},e.prototype.rotateCounterClockwise45=function(){throw new i.default("This luminance source does not support rotation by 45 degrees.")},e.prototype.toString=function(){for(var e=new Uint8ClampedArray(this.width),t=new n.default,r=0;r=0&&(r=e.isRange(s,a,!1))}return n},t.prototype.decodeRow=function(e,r,n){var i=t.findStartGuardPattern(r),c=null==n?null:n.get(9);if(null!=c){var p=new u.default((i[0]+i[1])/2,e);c.foundPossibleResultPoint(p)}var v=this.decodeMiddle(r,i,this.decodeRowStringBuffer),g=v.rowOffset,m=v.resultString;if(null!=c){var y=new u.default(g,e);c.foundPossibleResultPoint(y)}var _=t.decodeEnd(r,g);if(null!=c){var w=new u.default((_[0]+_[1])/2,e);c.foundPossibleResultPoint(w)}var C=_[1],E=C+(C-_[0]);if(E>=r.getSize()||!r.isRange(C,E,!1))throw new l.default;var S=m.toString();if(S.length<8)throw new d.default;if(!t.checkChecksum(S))throw new h.default;var b=(i[1]+i[0])/2,T=(_[1]+_[0])/2,A=this.getBarcodeFormat(),O=[new u.default(b,e),new u.default(T,e)],I=new a.default(S,null,0,O,A,(new Date).getTime()),R=0;try{var P=f.default.decodeRow(e,r,_[1]);I.putMetadata(s.default.UPC_EAN_EXTENSION,P.getText()),I.putAllMetadata(P.getResultMetadata()),I.addResultPoints(P.getResultPoints()),R=P.getText().length}catch(e){}var M=null==n?null:n.get(10);if(null!=M){var N=!1;for(var D in M)if(R.toString()===D){N=!0;break}if(!N)throw new l.default}return A===o.default.EAN_13||o.default.UPC_A,I},t.checkChecksum=function(e){return t.checkStandardUPCEANChecksum(e)},t.checkStandardUPCEANChecksum=function(e){var r=e.length;if(0===r)return!1;var n=parseInt(e.charAt(r-1),10);return t.getStandardUPCEANChecksum(e.substring(0,r-1))===n},t.getStandardUPCEANChecksum=function(e){for(var t=e.length,r=0,n=t-1;n>=0;n-=2){if((i=e.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||i>9)throw new d.default;r+=i}for(r*=3,n=t-2;n>=0;n-=2){var i;if((i=e.charAt(n).charCodeAt(0)-"0".charCodeAt(0))<0||i>9)throw new d.default;r+=i}return(1e3-r)%10},t.decodeEnd=function(e,r){return t.findGuardPattern(e,r,!1,t.START_END_PATTERN,new Array(t.START_END_PATTERN.length).fill(0))},t.findGuardPattern=function(e,r,n,i,o){for(var a=e.getSize(),s=0,u=r=n?e.getNextUnset(r):e.getNextSet(r),f=i.length,d=n,h=r;h=0)return a;throw new l.default},t.MAX_AVG_VARIANCE=.48,t.MAX_INDIVIDUAL_VARIANCE=.7,t.START_END_PATTERN=[1,1,1],t.MIDDLE_PATTERN=[1,1,1,1,1],t.END_PATTERN=[1,1,1,1,1,1],t.L_PATTERNS=[[3,2,1,1],[2,2,2,1],[2,1,2,2],[1,4,1,1],[1,1,3,2],[1,2,3,1],[1,1,1,4],[1,3,1,2],[1,2,1,3],[3,1,1,2]],t}(c.default);t.default=p},function(e,t,r){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.ERROR_CORRECTION=0]="ERROR_CORRECTION",e[e.CHARACTER_SET=1]="CHARACTER_SET",e[e.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",e[e.MIN_SIZE=3]="MIN_SIZE",e[e.MAX_SIZE=4]="MAX_SIZE",e[e.MARGIN=5]="MARGIN",e[e.PDF417_COMPACT=6]="PDF417_COMPACT",e[e.PDF417_COMPACTION=7]="PDF417_COMPACTION",e[e.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",e[e.AZTEC_LAYERS=9]="AZTEC_LAYERS",e[e.QR_VERSION=10]="QR_VERSION"}(n||(n={})),t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(40),i=r(1);!function(e){e[e.L=0]="L",e[e.M=1]="M",e[e.Q=2]="Q",e[e.H=3]="H"}(t.ErrorCorrectionLevelValues||(t.ErrorCorrectionLevelValues={}));var o=function(){function e(t,r,n){this.value=t,this.stringValue=r,this.bits=n,e.FOR_BITS.set(n,this),e.FOR_VALUE.set(t,this)}return e.prototype.getValue=function(){return this.value},e.prototype.getBits=function(){return this.bits},e.fromString=function(t){switch(t){case"L":return e.L;case"M":return e.M;case"Q":return e.Q;case"H":return e.H;default:throw new n.default(t+"not available")}},e.prototype.toString=function(){return this.stringValue},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;return this.value===r.value},e.forBits=function(t){if(t<0||t>=e.FOR_BITS.size)throw new i.default;return e.FOR_BITS.get(t)},e.FOR_BITS=new Map,e.FOR_VALUE=new Map,e.L=new e(0,"L",1),e.M=new e(1,"M",0),e.Q=new e(2,"Q",3),e.H=new e(3,"H",2),e}();t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13),i=r(7),o=r(1),a=function(){function e(e,t){if(0===t.length)throw new o.default;this.field=e;var r=t.length;if(r>1&&0===t[0]){for(var n=1;na.length){var s=r;r=a,a=s}var u=new Int32Array(a.length),c=a.length-r.length;i.default.arraycopy(a,0,u,0,c);for(var f=c;f=e.getDegree()&&!n.isZero();){var s=n.getDegree()-e.getDegree(),u=t.multiply(n.getCoefficient(n.getDegree()),a),c=e.multiplyByMonomial(s,u),f=t.buildMonomial(s,u);r=r.addOrSubtract(f),n=n.addOrSubtract(c)}return[r,n]},e.prototype.toString=function(){for(var e="",t=this.getDegree();t>=0;t--){var r=this.getCoefficient(t);if(0!==r){if(r<0?(e+=" - ",r=-r):e.length>0&&(e+=" + "),0===t||1!==r){var n=this.field.log(r);0===n?e+="1":1===n?e+="a":(e+="a^",e+=n)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e},e}();t.default=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.numberOfTrailingZeros=function(e){var t;if(0===e)return 32;var r=31;return 0!=(t=e<<16)&&(r-=16,e=t),0!=(t=e<<8)&&(r-=8,e=t),0!=(t=e<<4)&&(r-=4,e=t),0!=(t=e<<2)&&(r-=2,e=t),r-(e<<1>>>31)},e.numberOfLeadingZeros=function(e){if(0===e)return 32;var t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-(e>>>31)},e.toHexString=function(e){return e.toString(16)},e.bitCount=function(e){return e=(e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135,63&(e+=e>>>8)+(e>>>16)},e.MIN_VALUE_32_BITS=-2147483648,e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(65),i=r(64),o=r(63),a=r(62),s=r(0),u=r(40),c=r(11),f=r(4),l=function(){function e(e,t,r){void 0===t&&(t=500),this.reader=e,this.timeBetweenScansMillis=t,this.hints=r}return e.prototype.getVideoInputDevices=function(){return new Promise(function(e,t){navigator.mediaDevices.enumerateDevices().then(function(t){for(var r=new Array,n=0,o=0,a=t.length;o!==a;o++){var s=t[o];"videoinput"===s.kind&&(r.push(new i.VideoInputDevice(s.deviceId,s.label||"Video source "+n)),n++)}e(r)}).catch(function(e){t(e)})})},e.prototype.decodeFromInputVideoDevice=function(e,t){var r;this.reset(),this.prepareVideoElement(t),r=void 0===e?{video:{facingMode:"environment"}}:{video:{deviceId:{exact:e}}};var n=this;return new Promise(function(e,t){navigator.mediaDevices.getUserMedia(r).then(function(r){n.stream=r,n.videoElement.srcObject=r,n.videoPlayingEventListener=function(){n.decodeOnceWithDelay(e,t)},n.videoElement.addEventListener("playing",n.videoPlayingEventListener),n.videoElement.play()}).catch(function(e){t(e)})})},e.prototype.decodeFromVideoSource=function(e,t){this.reset(),this.prepareVideoElement(t);var r=this;return new Promise(function(t,n){r.videoPlayEndedEventListener=function(){r.stop(),n(new s.default)},r.videoElement.addEventListener("ended",r.videoPlayEndedEventListener),r.videoPlayingEventListener=function(){r.decodeOnceWithDelay(t,n)},r.videoElement.addEventListener("playing",r.videoPlayingEventListener),r.videoElement.setAttribute("autoplay","true"),r.videoElement.setAttribute("src",e)})},e.prototype.prepareVideoElement=function(e){void 0===e?(this.videoElement=document.createElement("video"),this.videoElement.width=640,this.videoElement.height=480):this.videoElement="string"==typeof e?this.getMediaElement(e,"video"):e,this.videoElement.setAttribute("autoplay","true"),this.videoElement.setAttribute("muted","true"),this.videoElement.setAttribute("playsinline","true"),this.videoElement.setAttribute("autofocus","true")},e.prototype.getMediaElement=function(e,t){var r=document.getElementById(e);if(null===r)throw new u.default("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==t.toLowerCase())throw new u.default("element with id '"+e+"' must be an "+t+" element");return r},e.prototype.decodeFromImage=function(e,t){var r=this;if(this.reset(),void 0===e&&void 0===t)throw new u.default("either imageElement with a src set or an url must be provided");this.prepareImageElement(e);var n=this;return new Promise(function(e,i){if(void 0!==t)n.imageLoadedEventListener=function(){n.decodeOnce(e,i,!1,!0)},n.imageElement.addEventListener("load",n.imageLoadedEventListener),n.imageElement.src=t;else{if(!r.isImageLoaded(r.imageElement))throw new u.default("either src or a loaded img should be provided");n.decodeOnce(e,i,!1,!0)}})},e.prototype.isImageLoaded=function(e){return!!e.complete&&0!==e.naturalWidth},e.prototype.prepareImageElement=function(e){void 0===e?(this.imageElement=document.createElement("img"),this.imageElement.width=200,this.imageElement.height=200):this.imageElement="string"==typeof e?this.getMediaElement(e,"img"):e},e.prototype.decodeOnceWithDelay=function(e,t){this.timeoutHandler=window.setTimeout(this.decodeOnce.bind(this,e,t),this.timeBetweenScansMillis)},e.prototype.decodeOnce=function(e,t,r,i){void 0===r&&(r=!0),void 0===i&&(i=!0),void 0===this.canvasElementContext&&this.prepareCaptureCanvas(),this.drawImageOnCanvas(this.canvasElementContext,this.videoElement||this.imageElement);var u=new n.HTMLCanvasElementLuminanceSource(this.canvasElement),l=new o.default(new a.default(u));try{e(this.readerDecode(l))}catch(n){r&&n instanceof s.default?this.decodeOnceWithDelay(e,t):i&&(n instanceof c.default||n instanceof f.default)?this.decodeOnceWithDelay(e,t):t(n)}},e.prototype.drawImageOnCanvas=function(e,t){e.drawImage(t,0,0)},e.prototype.readerDecode=function(e){return this.reader.decode(e,this.hints)},e.prototype.prepareCaptureCanvas=function(){var e,t,r=document.createElement("canvas");void 0!==this.videoElement?(e=this.videoElement.videoWidth,t=this.videoElement.videoHeight):(e=this.imageElement.naturalWidth||this.imageElement.width,t=this.imageElement.naturalHeight||this.imageElement.height),r.style.width=e+"px",r.style.height=t+"px",r.width=e,r.height=t,this.canvasElement=r,this.canvasElementContext=r.getContext("2d")},e.prototype.stop=function(){void 0!==this.timeoutHandler&&(window.clearTimeout(this.timeoutHandler),this.timeoutHandler=void 0),void 0!==this.stream&&(this.stream.getTracks()[0].stop(),this.stream=void 0)},e.prototype.reset=function(){this.stop(),void 0!==this.videoPlayEndedEventListener&&void 0!==this.videoElement&&this.videoElement.removeEventListener("ended",this.videoPlayEndedEventListener),void 0!==this.videoPlayingEventListener&&void 0!==this.videoElement&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoElement&&(this.videoElement.srcObject=void 0,this.videoElement.removeAttribute("src"),this.videoElement=void 0),void 0!==this.videoPlayEndedEventListener&&void 0!==this.imageElement&&this.imageElement.removeEventListener("load",this.imageLoadedEventListener),void 0!==this.imageElement&&(this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0),this.canvasElementContext=void 0,this.canvasElement=void 0},e}();t.BrowserCodeReader=l},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),a=r(48),s=r(47),u=r(46),c=r(75),f=r(0),l=function(e){function t(t){var r=e.call(this)||this;r.readers=[];var n=t?t.get(2):null,i=t&&void 0!==t.get(6);return n&&(n.includes(o.default.EAN_13)&&r.readers.push(new c.default(t)),n.includes(o.default.CODE_39)&&r.readers.push(new a.default(i)),n.includes(o.default.CODE_128)&&r.readers.push(new s.default),n.includes(o.default.ITF)&&r.readers.push(new u.default)),0===r.readers.length&&(r.readers.push(new a.default),r.readers.push(new c.default(t)),r.readers.push(new s.default),r.readers.push(new u.default)),r}return i(t,e),t.prototype.decodeRow=function(e,t,r){for(var n=0;n>\n"),e.toString()},e.prototype.setMode=function(e){this.mode=e},e.prototype.setECLevel=function(e){this.ecLevel=e},e.prototype.setVersion=function(e){this.version=e},e.prototype.setMaskPattern=function(e){this.maskPattern=e},e.prototype.setMatrix=function(e){this.matrix=e},e.isValidMaskPattern=function(t){return t>=0&&t159)&&(i<224||i>235))return!1}return!0},e.chooseMaskPattern=function(e,t,r,n){for(var i=Number.MAX_SAFE_INTEGER,o=-1,a=0;a=(e+7)/8},e.terminateBits=function(e,t){var r=8*e;if(t.getSize()>r)throw new g.default("data bits cannot fit in the QR Code"+t.getSize()+" > "+r);for(var n=0;n<4&&t.getSize()0)for(n=i;n<8;n++)t.appendBit(!1);var o=e-t.getSizeInBytes();for(n=0;n=r)throw new g.default("Block ID too large");var a=e%r,s=r-a,u=Math.floor(e/r),c=u+1,f=Math.floor(t/r),l=f+1,d=u-f,h=c-l;if(d!==h)throw new g.default("EC bytes mismatch");if(r!==s+a)throw new g.default("RS blocks mismatch");if(e!==(f+d)*s+(l+h)*a)throw new g.default("Total bytes mismatch");n=1<=0&&r<=9},e.appendNumericBytes=function(t,r){for(var n=t.length,i=0;i=33088&&a<=40956?s=a-33088:a>=57408&&a<=60351&&(s=a-49472),-1===s)throw new g.default("Invalid byte sequence");var u=192*(s>>8)+(255&s);t.appendBits(u,13)}},e.appendECI=function(e,t){t.appendBits(u.default.ECI.getBits(),4),t.appendBits(e.getValue(),8)},e.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),e.DEFAULT_BYTE_MODE_ENCODING=o.default.UTF8.getName(),e}();t.default=m},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(86),i=r(8),o=r(2),a=r(10),s=r(6),u=r(81),c=r(7),f=r(0),l=function(){function e(){this.decoder=new n.default}return e.prototype.decode=function(t,r){var n,s;if(void 0===r&&(r=null),null!=r&&r.has(1)){var f=e.extractPureBits(t.getBlackMatrix());n=this.decoder.decode(f),s=e.NO_POINTS}else{var l=new u.default(t.getBlackMatrix()).detect();n=this.decoder.decode(l.getBits()),s=l.getPoints()}var d=n.getRawBytes(),h=new i.default(n.getText(),d,8*d.length,s,o.default.DATA_MATRIX,c.default.currentTimeMillis()),p=n.getByteSegments();null!=p&&h.putMetadata(a.default.BYTE_SEGMENTS,p);var v=n.getECLevel();return null!=v&&h.putMetadata(a.default.ERROR_CORRECTION_LEVEL,v),h},e.prototype.reset=function(){},e.extractPureBits=function(e){var t=e.getTopLeftOnBit(),r=e.getBottomRightOnBit();if(null==t||null==r)throw new f.default;var n=this.moduleSize(t,e),i=t[1],o=r[1],a=t[0],u=(r[0]-a+1)/n,c=(o-i+1)/n;if(u<=0||c<=0)throw new f.default;var l=n/2;i+=l,a+=l;for(var d=new s.default(u,c),h=0;h=0&&this.structuredAppendSequenceNumber>=0},e.prototype.getStructuredAppendParity=function(){return this.structuredAppendParity},e.prototype.getStructuredAppendSequenceNumber=function(){return this.structuredAppendSequenceNumber},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=function(){function e(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}return e.prototype.getBitOffset=function(){return this.bitOffset},e.prototype.getByteOffset=function(){return this.byteOffset},e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new n.default(""+e);var t=0,r=this.bitOffset,i=this.byteOffset,o=this.bytes;if(r>0){var a=8-r,s=e>8-s<<(c=a-s);t=(o[i]&u)>>c,e-=s,8===(r+=s)&&(r=0,i++)}if(e>0){for(;e>=8;)t=t<<8|255&o[i],i++,e-=8;var c;e>0&&(u=255>>(c=8-e)<>c,r+=e)}return this.bitOffset=r,this.byteOffset=i,t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),i=r(57),o=r(98),a=r(97),s=r(4),u=r(1),c=function(){function e(e,t){for(var r=[],n=2;n40)throw new u.default;return e.VERSIONS[t-1]},e.decodeVersionInformation=function(t){for(var r=Number.MAX_SAFE_INTEGER,n=0,o=0;o6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t},e.prototype.toString=function(){return""+this.versionNumber},e.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),e.VERSIONS=[new e(1,new Int32Array(0),new o.default(7,new a.default(1,19)),new o.default(10,new a.default(1,16)),new o.default(13,new a.default(1,13)),new o.default(17,new a.default(1,9))),new e(2,Int32Array.from([6,18]),new o.default(10,new a.default(1,34)),new o.default(16,new a.default(1,28)),new o.default(22,new a.default(1,22)),new o.default(28,new a.default(1,16))),new e(3,Int32Array.from([6,22]),new o.default(15,new a.default(1,55)),new o.default(26,new a.default(1,44)),new o.default(18,new a.default(2,17)),new o.default(22,new a.default(2,13))),new e(4,Int32Array.from([6,26]),new o.default(20,new a.default(1,80)),new o.default(18,new a.default(2,32)),new o.default(26,new a.default(2,24)),new o.default(16,new a.default(4,9))),new e(5,Int32Array.from([6,30]),new o.default(26,new a.default(1,108)),new o.default(24,new a.default(2,43)),new o.default(18,new a.default(2,15),new a.default(2,16)),new o.default(22,new a.default(2,11),new a.default(2,12))),new e(6,Int32Array.from([6,34]),new o.default(18,new a.default(2,68)),new o.default(16,new a.default(4,27)),new o.default(24,new a.default(4,19)),new o.default(28,new a.default(4,15))),new e(7,Int32Array.from([6,22,38]),new o.default(20,new a.default(2,78)),new o.default(18,new a.default(4,31)),new o.default(18,new a.default(2,14),new a.default(4,15)),new o.default(26,new a.default(4,13),new a.default(1,14))),new e(8,Int32Array.from([6,24,42]),new o.default(24,new a.default(2,97)),new o.default(22,new a.default(2,38),new a.default(2,39)),new o.default(22,new a.default(4,18),new a.default(2,19)),new o.default(26,new a.default(4,14),new a.default(2,15))),new e(9,Int32Array.from([6,26,46]),new o.default(30,new a.default(2,116)),new o.default(22,new a.default(3,36),new a.default(2,37)),new o.default(20,new a.default(4,16),new a.default(4,17)),new o.default(24,new a.default(4,12),new a.default(4,13))),new e(10,Int32Array.from([6,28,50]),new o.default(18,new a.default(2,68),new a.default(2,69)),new o.default(26,new a.default(4,43),new a.default(1,44)),new o.default(24,new a.default(6,19),new a.default(2,20)),new o.default(28,new a.default(6,15),new a.default(2,16))),new e(11,Int32Array.from([6,30,54]),new o.default(20,new a.default(4,81)),new o.default(30,new a.default(1,50),new a.default(4,51)),new o.default(28,new a.default(4,22),new a.default(4,23)),new o.default(24,new a.default(3,12),new a.default(8,13))),new e(12,Int32Array.from([6,32,58]),new o.default(24,new a.default(2,92),new a.default(2,93)),new o.default(22,new a.default(6,36),new a.default(2,37)),new o.default(26,new a.default(4,20),new a.default(6,21)),new o.default(28,new a.default(7,14),new a.default(4,15))),new e(13,Int32Array.from([6,34,62]),new o.default(26,new a.default(4,107)),new o.default(22,new a.default(8,37),new a.default(1,38)),new o.default(24,new a.default(8,20),new a.default(4,21)),new o.default(22,new a.default(12,11),new a.default(4,12))),new e(14,Int32Array.from([6,26,46,66]),new o.default(30,new a.default(3,115),new a.default(1,116)),new o.default(24,new a.default(4,40),new a.default(5,41)),new o.default(20,new a.default(11,16),new a.default(5,17)),new o.default(24,new a.default(11,12),new a.default(5,13))),new e(15,Int32Array.from([6,26,48,70]),new o.default(22,new a.default(5,87),new a.default(1,88)),new o.default(24,new a.default(5,41),new a.default(5,42)),new o.default(30,new a.default(5,24),new a.default(7,25)),new o.default(24,new a.default(11,12),new a.default(7,13))),new e(16,Int32Array.from([6,26,50,74]),new o.default(24,new a.default(5,98),new a.default(1,99)),new o.default(28,new a.default(7,45),new a.default(3,46)),new o.default(24,new a.default(15,19),new a.default(2,20)),new o.default(30,new a.default(3,15),new a.default(13,16))),new e(17,Int32Array.from([6,30,54,78]),new o.default(28,new a.default(1,107),new a.default(5,108)),new o.default(28,new a.default(10,46),new a.default(1,47)),new o.default(28,new a.default(1,22),new a.default(15,23)),new o.default(28,new a.default(2,14),new a.default(17,15))),new e(18,Int32Array.from([6,30,56,82]),new o.default(30,new a.default(5,120),new a.default(1,121)),new o.default(26,new a.default(9,43),new a.default(4,44)),new o.default(28,new a.default(17,22),new a.default(1,23)),new o.default(28,new a.default(2,14),new a.default(19,15))),new e(19,Int32Array.from([6,30,58,86]),new o.default(28,new a.default(3,113),new a.default(4,114)),new o.default(26,new a.default(3,44),new a.default(11,45)),new o.default(26,new a.default(17,21),new a.default(4,22)),new o.default(26,new a.default(9,13),new a.default(16,14))),new e(20,Int32Array.from([6,34,62,90]),new o.default(28,new a.default(3,107),new a.default(5,108)),new o.default(26,new a.default(3,41),new a.default(13,42)),new o.default(30,new a.default(15,24),new a.default(5,25)),new o.default(28,new a.default(15,15),new a.default(10,16))),new e(21,Int32Array.from([6,28,50,72,94]),new o.default(28,new a.default(4,116),new a.default(4,117)),new o.default(26,new a.default(17,42)),new o.default(28,new a.default(17,22),new a.default(6,23)),new o.default(30,new a.default(19,16),new a.default(6,17))),new e(22,Int32Array.from([6,26,50,74,98]),new o.default(28,new a.default(2,111),new a.default(7,112)),new o.default(28,new a.default(17,46)),new o.default(30,new a.default(7,24),new a.default(16,25)),new o.default(24,new a.default(34,13))),new e(23,Int32Array.from([6,30,54,78,102]),new o.default(30,new a.default(4,121),new a.default(5,122)),new o.default(28,new a.default(4,47),new a.default(14,48)),new o.default(30,new a.default(11,24),new a.default(14,25)),new o.default(30,new a.default(16,15),new a.default(14,16))),new e(24,Int32Array.from([6,28,54,80,106]),new o.default(30,new a.default(6,117),new a.default(4,118)),new o.default(28,new a.default(6,45),new a.default(14,46)),new o.default(30,new a.default(11,24),new a.default(16,25)),new o.default(30,new a.default(30,16),new a.default(2,17))),new e(25,Int32Array.from([6,32,58,84,110]),new o.default(26,new a.default(8,106),new a.default(4,107)),new o.default(28,new a.default(8,47),new a.default(13,48)),new o.default(30,new a.default(7,24),new a.default(22,25)),new o.default(30,new a.default(22,15),new a.default(13,16))),new e(26,Int32Array.from([6,30,58,86,114]),new o.default(28,new a.default(10,114),new a.default(2,115)),new o.default(28,new a.default(19,46),new a.default(4,47)),new o.default(28,new a.default(28,22),new a.default(6,23)),new o.default(30,new a.default(33,16),new a.default(4,17))),new e(27,Int32Array.from([6,34,62,90,118]),new o.default(30,new a.default(8,122),new a.default(4,123)),new o.default(28,new a.default(22,45),new a.default(3,46)),new o.default(30,new a.default(8,23),new a.default(26,24)),new o.default(30,new a.default(12,15),new a.default(28,16))),new e(28,Int32Array.from([6,26,50,74,98,122]),new o.default(30,new a.default(3,117),new a.default(10,118)),new o.default(28,new a.default(3,45),new a.default(23,46)),new o.default(30,new a.default(4,24),new a.default(31,25)),new o.default(30,new a.default(11,15),new a.default(31,16))),new e(29,Int32Array.from([6,30,54,78,102,126]),new o.default(30,new a.default(7,116),new a.default(7,117)),new o.default(28,new a.default(21,45),new a.default(7,46)),new o.default(30,new a.default(1,23),new a.default(37,24)),new o.default(30,new a.default(19,15),new a.default(26,16))),new e(30,Int32Array.from([6,26,52,78,104,130]),new o.default(30,new a.default(5,115),new a.default(10,116)),new o.default(28,new a.default(19,47),new a.default(10,48)),new o.default(30,new a.default(15,24),new a.default(25,25)),new o.default(30,new a.default(23,15),new a.default(25,16))),new e(31,Int32Array.from([6,30,56,82,108,134]),new o.default(30,new a.default(13,115),new a.default(3,116)),new o.default(28,new a.default(2,46),new a.default(29,47)),new o.default(30,new a.default(42,24),new a.default(1,25)),new o.default(30,new a.default(23,15),new a.default(28,16))),new e(32,Int32Array.from([6,34,60,86,112,138]),new o.default(30,new a.default(17,115)),new o.default(28,new a.default(10,46),new a.default(23,47)),new o.default(30,new a.default(10,24),new a.default(35,25)),new o.default(30,new a.default(19,15),new a.default(35,16))),new e(33,Int32Array.from([6,30,58,86,114,142]),new o.default(30,new a.default(17,115),new a.default(1,116)),new o.default(28,new a.default(14,46),new a.default(21,47)),new o.default(30,new a.default(29,24),new a.default(19,25)),new o.default(30,new a.default(11,15),new a.default(46,16))),new e(34,Int32Array.from([6,34,62,90,118,146]),new o.default(30,new a.default(13,115),new a.default(6,116)),new o.default(28,new a.default(14,46),new a.default(23,47)),new o.default(30,new a.default(44,24),new a.default(7,25)),new o.default(30,new a.default(59,16),new a.default(1,17))),new e(35,Int32Array.from([6,30,54,78,102,126,150]),new o.default(30,new a.default(12,121),new a.default(7,122)),new o.default(28,new a.default(12,47),new a.default(26,48)),new o.default(30,new a.default(39,24),new a.default(14,25)),new o.default(30,new a.default(22,15),new a.default(41,16))),new e(36,Int32Array.from([6,24,50,76,102,128,154]),new o.default(30,new a.default(6,121),new a.default(14,122)),new o.default(28,new a.default(6,47),new a.default(34,48)),new o.default(30,new a.default(46,24),new a.default(10,25)),new o.default(30,new a.default(2,15),new a.default(64,16))),new e(37,Int32Array.from([6,28,54,80,106,132,158]),new o.default(30,new a.default(17,122),new a.default(4,123)),new o.default(28,new a.default(29,46),new a.default(14,47)),new o.default(30,new a.default(49,24),new a.default(10,25)),new o.default(30,new a.default(24,15),new a.default(46,16))),new e(38,Int32Array.from([6,32,58,84,110,136,162]),new o.default(30,new a.default(4,122),new a.default(18,123)),new o.default(28,new a.default(13,46),new a.default(32,47)),new o.default(30,new a.default(48,24),new a.default(14,25)),new o.default(30,new a.default(42,15),new a.default(32,16))),new e(39,Int32Array.from([6,26,54,82,110,138,166]),new o.default(30,new a.default(20,117),new a.default(4,118)),new o.default(28,new a.default(40,47),new a.default(7,48)),new o.default(30,new a.default(43,24),new a.default(22,25)),new o.default(30,new a.default(10,15),new a.default(67,16))),new e(40,Int32Array.from([6,30,58,86,114,142,170]),new o.default(30,new a.default(19,118),new a.default(6,119)),new o.default(28,new a.default(18,47),new a.default(31,48)),new o.default(30,new a.default(34,24),new a.default(34,25)),new o.default(30,new a.default(20,15),new a.default(61,16)))],e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13),i=r(23),o=r(58),a=r(16),s=function(){function e(e){this.field=e}return e.prototype.decode=function(e,t){for(var r=this.field,a=new i.default(r,e),s=new Int32Array(t),u=!0,c=0;c=(r/2|0);){var l=s,d=c;if(c=f,(s=u).isZero())throw new o.default("r_{i-1} was zero");u=l;for(var h=i.getZero(),p=s.getCoefficient(s.getDegree()),v=i.inverse(p);u.getDegree()>=s.getDegree()&&!u.isZero();){var g=u.getDegree()-s.getDegree(),m=i.multiply(u.getCoefficient(u.getDegree()),v);h=h.addOrSubtract(i.buildMonomial(g,m)),u=u.addOrSubtract(s.multiplyByMonomial(g,m))}if(f=h.multiply(c).addOrSubtract(d),u.getDegree()>=s.getDegree())throw new a.default("Division algorithm failed to reduce polynomial?")}var y=f.getCoefficient(0);if(0===y)throw new o.default("sigmaTilde(0) was zero");var _=i.inverse(y);return[f.multiplyScalar(_),u.multiplyScalar(_)]},e.prototype.findErrorLocations=function(e){var t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);for(var r=new Int32Array(t),n=0,i=this.field,a=1;a=u||i>=o)throw new f.default;if(o-i!=u-s&&(u=s+(o-i))>=e.getWidth())throw new f.default;var c=Math.round((u-s+1)/n),l=Math.round((o-i+1)/n);if(c<=0||l<=0)throw new f.default;if(l!==c)throw new f.default;var d=Math.floor(n/2);i+=d;var h=(s+=d)+Math.floor((c-1)*n)-u;if(h>0){if(h>d)throw new f.default;s-=h}var p=i+Math.floor((l-1)*n)-o;if(p>0){if(p>d)throw new f.default;i-=p}for(var v=new a.default(c,l),g=0;g>1,s=n(r,t[a]);if(s>0)i=a+1;else{if(!(s<0))return a;o=a-1}}return-i-1},e.numberComparator=function(e,t){return e-t},e}();t.default=i},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(r(5).default);t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),i=r(21),o=r(6),a=r(22),s=r(29),u=r(1),c=r(16),f=function(){function e(){}return e.prototype.encode=function(t,r,o,c,f){if(0===t.length)throw new u.default("Found empty contents");if(r!==n.default.QR_CODE)throw new u.default("Can only encode QR_CODE, but got "+r);if(o<0||c<0)throw new u.default("Requested dimensions are too small: "+o+"x"+c);var l=a.default.L,d=e.QUIET_ZONE_SIZE;null!==f&&(void 0!==f.get(i.default.ERROR_CORRECTION)&&(l=a.default.fromString(f.get(i.default.ERROR_CORRECTION).toString())),void 0!==f.get(i.default.MARGIN)&&(d=Number.parseInt(f.get(i.default.MARGIN).toString(),10)));var h=s.default.encode(t,l,f);return e.renderResult(h,o,c,d)},e.renderResult=function(e,t,r,n){var i=e.getMatrix();if(null===i)throw new c.default;for(var a=i.getWidth(),s=i.getHeight(),u=a+2*n,f=s+2*n,l=Math.max(t,u),d=Math.max(r,f),h=Math.min(Math.floor(l/u),Math.floor(d/f)),p=Math.floor((l-a*h)/2),v=Math.floor((d-s*h)/2),g=new o.default(l,d),m=0,y=v;m=10&&(u|=1<<5-c)}for(n=t.determineFirstDigit(n,u),s=a.default.findGuardPattern(e,s,!0,a.default.MIDDLE_PATTERN,new Array(a.default.MIDDLE_PATTERN.length).fill(0))[1],c=0;c<6&&sg&&(g=_)}if(!v&&p>g&&(v=!0),!v)throw new l.default;var w=[new s.default(i[1],e),new s.default(u[0],e)];return new a.default(d,null,0,w,o.default.ITF,(new Date).getTime())},t.decodeMiddle=function(e,r,n,i){var o=new Array(10),a=new Array(5),s=new Array(5);for(o.fill(0),a.fill(0),s.fill(0);r0&&n>=0&&!e.get(n);n--)r--;if(0!==r)throw new d.default},t.skipWhiteSpace=function(e){var t=e.getSize(),r=e.getNextSet(0);if(r===t)throw new d.default;return r},t.prototype.decodeEnd=function(e){e.reverse();try{var r=t.skipWhiteSpace(e),n=void 0;try{n=t.findGuardPattern(e,r,t.END_PATTERN_REVERSED[0])}catch(i){n=t.findGuardPattern(e,r,t.END_PATTERN_REVERSED[1])}this.validateQuietZone(e,n[0]);var i=n[0];return n[0]=e.getSize()-n[1],n[1]=e.getSize()-i,n}finally{e.reverse()}},t.findGuardPattern=function(e,r,n){var i=n.length,o=new Array(i),a=e.getSize(),s=!1,c=0,l=r;o.fill(0);for(var h=r;h=0)return n%10;throw new d.default},t.W=3,t.w=2,t.N=1,t.PATTERNS=[[1,1,2,2,1],[2,1,1,1,2],[1,2,1,1,2],[2,2,1,1,1],[1,1,2,1,2],[2,1,2,1,1],[1,2,2,1,1],[1,1,1,2,2],[2,1,1,2,1],[1,2,1,2,1],[1,1,3,3,1],[3,1,1,1,3],[1,3,1,1,3],[3,3,1,1,1],[1,1,3,1,3],[3,1,3,1,1],[1,3,3,1,1],[1,1,1,3,3],[3,1,1,3,1],[1,3,1,3,1]],t.MAX_AVG_VARIANCE=.38,t.MAX_INDIVIDUAL_VARIANCE=.5,t.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],t.START_PATTERN=[1,1,1,1],t.END_PATTERN_REVERSED=[[1,1,2],[1,1,3]],t}(u.default);t.default=h},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),a=r(8),s=r(3),u=r(9),c=r(0),f=r(4),l=r(11),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.findStartPattern=function(e){for(var r=e.getSize(),n=e.getNextSet(0),i=0,o=[0,0,0,0,0,0],a=n,s=!1,f=n;f=0&&e.isRange(Math.max(0,a-(f-a)/2),a,!1))return[a,f,d];a+=o[0]+o[1],o.splice(0,2),o[i-1]=0,o[i]=0,i--}else i++;o[i]=1,s=!s}throw new c.default},t.decodeCode=function(e,r,n){u.default.recordPattern(e,n,r);for(var i=t.MAX_AVG_VARIANCE,o=-1,a=0;a=0)return o;throw new c.default},t.prototype.decodeRow=function(e,r,n){var i,u=n&&!0===n.get(7),d=t.findStartPattern(r),h=d[2],p=0,v=new Uint8Array(20);switch(v[p++]=h,h){case t.CODE_START_A:i=t.CODE_CODE_A;break;case t.CODE_START_B:i=t.CODE_CODE_B;break;case t.CODE_START_C:i=t.CODE_CODE_C;break;default:throw new f.default}for(var g=!1,m=!1,y="",_=d[0],w=d[1],C=[0,0,0,0,0,0],E=0,S=0,b=h,T=0,A=!0,O=!1,I=!1;!g;){var R=m;switch(m=!1,E=S,S=t.decodeCode(r,C,w),v[p++]=S,S!==t.CODE_STOP&&(A=!0),S!==t.CODE_STOP&&(b+=++T*S),_=w,w+=C.reduce(function(e,t){return e+t},0),S){case t.CODE_START_A:case t.CODE_START_B:case t.CODE_START_C:throw new f.default}switch(i){case t.CODE_CODE_A:if(S<64)y+=I===O?String.fromCharCode(" ".charCodeAt(0)+S):String.fromCharCode(" ".charCodeAt(0)+S+128),I=!1;else if(S<96)y+=I===O?String.fromCharCode(S-64):String.fromCharCode(S+64),I=!1;else switch(S!==t.CODE_STOP&&(A=!1),S){case t.CODE_FNC_1:u&&(0===y.length?y+="]C1":y+=String.fromCharCode(29));break;case t.CODE_FNC_2:case t.CODE_FNC_3:break;case t.CODE_FNC_4_A:!O&&I?(O=!0,I=!1):O&&I?(O=!1,I=!1):I=!0;break;case t.CODE_SHIFT:m=!0,i=t.CODE_CODE_B;break;case t.CODE_CODE_B:i=t.CODE_CODE_B;break;case t.CODE_CODE_C:i=t.CODE_CODE_C;break;case t.CODE_STOP:g=!0}break;case t.CODE_CODE_B:if(S<96)y+=I===O?String.fromCharCode(" ".charCodeAt(0)+S):String.fromCharCode(" ".charCodeAt(0)+S+128),I=!1;else switch(S!==t.CODE_STOP&&(A=!1),S){case t.CODE_FNC_1:u&&(0===y.length?y+="]C1":y+=String.fromCharCode(29));break;case t.CODE_FNC_2:case t.CODE_FNC_3:break;case t.CODE_FNC_4_B:!O&&I?(O=!0,I=!1):O&&I?(O=!1,I=!1):I=!0;break;case t.CODE_SHIFT:m=!0,i=t.CODE_CODE_A;break;case t.CODE_CODE_A:i=t.CODE_CODE_A;break;case t.CODE_CODE_C:i=t.CODE_CODE_C;break;case t.CODE_STOP:g=!0}break;case t.CODE_CODE_C:if(S<100)S<10&&(y+="0"),y+=S;else switch(S!==t.CODE_STOP&&(A=!1),S){case t.CODE_FNC_1:u&&(0===y.length?y+="]C1":y+=String.fromCharCode(29));break;case t.CODE_CODE_A:i=t.CODE_CODE_A;break;case t.CODE_CODE_B:i=t.CODE_CODE_B;break;case t.CODE_STOP:g=!0}}R&&(i=i===t.CODE_CODE_A?t.CODE_CODE_B:t.CODE_CODE_A)}var P=w-_;if(w=r.getNextUnset(w),!r.isRange(w,Math.min(r.getSize(),w+(w-_)/2),!1))throw new c.default;if((b-=T*E)%103!==E)throw new l.default;var M=y.length;if(0===M)throw new c.default;M>0&&A&&(y=i===t.CODE_CODE_C?y.substring(0,M-2):y.substring(0,M-1));for(var N=(d[1]+d[0])/2,D=_+P/2,k=v.length,x=new Uint8Array(k),B=0;Bn&&(i=f);n=i,t=0;for(var s=0,u=0,c=0;cn&&(u|=1<0;c++){var f;if((f=e[c])>n&&(t--,2*f>=s))return-1}return u}}while(t>3);return-1},t.patternToChar=function(e){for(var r=0;r="A"&&o<="Z"))throw new s.default;a=String.fromCharCode(o.charCodeAt(0)+32);break;case"$":if(!(o>="A"&&o<="Z"))throw new s.default;a=String.fromCharCode(o.charCodeAt(0)-64);break;case"%":if(o>="A"&&o<="E")a=String.fromCharCode(o.charCodeAt(0)-38);else if(o>="F"&&o<="J")a=String.fromCharCode(o.charCodeAt(0)-11);else if(o>="K"&&o<="O")a=String.fromCharCode(o.charCodeAt(0)+16);else if(o>="P"&&o<="T")a=String.fromCharCode(o.charCodeAt(0)+43);else if("U"===o)a="\0";else if("V"===o)a="@";else if("W"===o)a="`";else{if("X"!==o&&"Y"!==o&&"Z"!==o)throw new s.default;a=""}break;case"/":if(o>="A"&&o<="O")a=String.fromCharCode(o.charCodeAt(0)-32);else{if("Z"!==o)throw new s.default;a=":"}}r+=a,n++}else r+=i}return r},t.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",t.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],t.ASTERISK_ENCODING=148,t}(c.default);t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=function(){function e(){}return e.applyMaskPenaltyRule1=function(t){return e.applyMaskPenaltyRule1Internal(t,!0)+e.applyMaskPenaltyRule1Internal(t,!1)},e.applyMaskPenaltyRule2=function(t){for(var r=0,n=t.getArray(),i=t.getWidth(),o=t.getHeight(),a=0;a=5&&(n+=e.N1+(u-5)),u=1,c=l)}u>=5&&(n+=e.N1+(u-5))}return n},e.N1=3,e.N2=3,e.N3=40,e.N4=10,e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(23),i=r(7),o=r(1),a=function(){function e(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new n.default(e,Int32Array.from([1])))}return e.prototype.buildGenerator=function(e){var t=this.cachedGenerators;if(e>=t.length)for(var r=t[t.length-1],i=this.field,o=t.length;o<=e;o++){var a=r.multiply(new n.default(i,Int32Array.from([1,i.exp(o-1+i.getGeneratorBase())])));t.push(a),r=a}return t[e]},e.prototype.encode=function(e,t){if(0===t)throw new o.default("No error correction bytes");var r=e.length-t;if(r<=0)throw new o.default("No data bytes provided");var a=this.buildGenerator(t),s=new Int32Array(r);i.default.arraycopy(e,0,s,0,r);for(var u=new n.default(this.field,s),c=(u=u.multiplyByMonomial(t,1)).divide(a)[1].getCoefficients(),f=t-c.length,l=0;l=this.height||this.rightInit>=this.width)throw new o.default}return e.prototype.detect=function(){for(var e=this.leftInit,t=this.rightInit,r=this.upInit,n=this.downInit,i=!1,a=!0,s=!1,u=!1,c=!1,f=!1,l=!1,d=this.width,h=this.height;a;){a=!1;for(var p=!0;(p||!u)&&t=d){i=!0;break}for(var v=!0;(v||!c)&&n=h){i=!0;break}for(var g=!0;(g||!f)&&e>=0;)(g=this.containsBlackPoint(r,n,e,!1))?(e--,a=!0,f=!0):f||e--;if(e<0){i=!0;break}for(var m=!0;(m||!l)&&r>=0;)(m=this.containsBlackPoint(e,t,r,!0))?(r--,a=!0,l=!0):l||r--;if(r<0){i=!0;break}a&&(s=!0)}if(!i&&s){for(var y=t-e,_=null,w=1;null===_&&wr||u<-1||u>i)throw new n.default;o=!1,-1===s?(t[a]=0,o=!0):s===r&&(t[a]=r-1,o=!0),-1===u?(t[a+1]=0,o=!0):u===i&&(t[a+1]=i-1,o=!0)}for(o=!0,a=t.length-2;a>=0&&o;a-=2){if(s=Math.floor(t[a]),u=Math.floor(t[a+1]),s<-1||s>r||u<-1||u>i)throw new n.default;o=!1,-1===s?(t[a]=0,o=!0):s===r&&(t[a]=r-1,o=!0),-1===u?(t[a+1]=0,o=!0):u===i&&(t[a+1]=i-1,o=!0)}},e}();t.default=i},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=r(52),a=r(6),s=r(31),u=r(0),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.sampleGrid=function(e,t,r,n,i,o,a,u,c,f,l,d,h,p,v,g,m,y,_){var w=s.default.quadrilateralToQuadrilateral(n,i,o,a,u,c,f,l,d,h,p,v,g,m,y,_);return this.sampleGridWithTransform(e,t,r,w)},t.prototype.sampleGridWithTransform=function(e,t,r,n){if(t<=0||r<=0)throw new u.default;for(var i=new a.default(t,r),s=new Float32Array(2*t),c=0;c3&&239===t[0]&&187===t[1]&&191===t[2],_=0;_0?0==(128&w)?a=!1:s--:0!=(128&w)&&(0==(64&w)?a=!1:(s++,0==(32&w)?u++:(s++,0==(16&w)?c++:(s++,0==(8&w)?f++:a=!1))))),i&&(w>127&&w<160?i=!1:w>159&&(w<192||215===w||247===w)&&m++),o&&(l>0?w<64||127===w||w>252?o=!1:l--:128===w||160===w||w>239?o=!1:w>160&&w<224?(d++,p=0,++h>v&&(v=h)):w>127?(l++,h=0,++p>g&&(g=p)):(h=0,p=0))}return a&&s>0&&(a=!1),o&&l>0&&(o=!1),a&&(y||u+c+f>0)?e.UTF8:o&&(e.ASSUME_SHIFT_JIS||v>=3||g>=3)?e.SHIFT_JIS:i&&o?2===v&&2===d||10*m>=n?e.SHIFT_JIS:e.ISO88591:i?e.ISO88591:o?e.SHIFT_JIS:a?e.UTF8:e.PLATFORM_DEFAULT_ENCODING},e.SHIFT_JIS=n.default.SJIS.getName(),e.GB2312="GB2312",e.ISO88591=n.default.ISO8859_1.getName(),e.EUC_JP="EUC_JP",e.UTF8=n.default.UTF8.getName(),e.PLATFORM_DEFAULT_ENCODING=e.UTF8,e.ASSUME_SHIFT_JIS=!1,e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this.mirrored=e}return e.prototype.isMirrored=function(){return this.mirrored},e.prototype.applyMirroredCorrection=function(e){if(this.mirrored&&null!==e&&!(e.length<3)){var t=e[0];e[0]=e[2],e[2]=t}},e}();t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(22),i=r(24),o=function(){function e(e){this.errorCorrectionLevel=n.default.forBits(e>>3&3),this.dataMask=7&e}return e.numBitsDiffering=function(e,t){return i.default.bitCount(e^t)},e.decodeFormatInformation=function(t,r){var n=e.doDecodeFormatInformation(t,r);return null!==n?n:e.doDecodeFormatInformation(t^e.FORMAT_INFO_MASK_QR,r^e.FORMAT_INFO_MASK_QR)},e.doDecodeFormatInformation=function(t,r){for(var n=Number.MAX_SAFE_INTEGER,i=0,o=0,a=e.FORMAT_INFO_DECODE_LOOKUP;o>t.LUMINANCE_SHIFT]++;var c=t.estimateBlackPoint(s);if(i<3)for(u=0;u>t.LUMINANCE_SHIFT]++;var d=t.estimateBlackPoint(o),h=e.getMatrix();for(a=0;ao&&(i=a,o=e[a]),e[a]>n&&(n=e[a]);var s=0,c=0;for(a=0;ac&&(s=a,c=p)}if(i>s){var l=i;i=s,s=l}if(s-i<=r/16)throw new u.default;var d=s-1,h=-1;for(a=s-1;a>i;a--){var p,v=a-i;(p=v*v*(s-a)*(n-e[a]))>h&&(d=a,h=p)}return d<=t.MINIMUM_DIMENSION&&i>=t.MINIMUM_DIMENSION){var o=r.getMatrix(),s=n>>t.BLOCK_SIZE_POWER;0!=(n&t.BLOCK_SIZE_MASK)&&s++;var u=i>>t.BLOCK_SIZE_POWER;0!=(i&t.BLOCK_SIZE_MASK)&&u++;var c=t.calculateBlackPoints(o,s,u,n,i),f=new a.default(n,i);t.calculateThresholdForBlock(o,s,u,n,i,c,f),this.matrix=f}else this.matrix=e.prototype.getBlackMatrix.call(this);return this.matrix},t.prototype.createBinarizer=function(e){return new t(e)},t.calculateThresholdForBlock=function(e,r,n,i,o,a,s){for(var u=o-t.BLOCK_SIZE,c=i-t.BLOCK_SIZE,f=0;fu&&(l=u);for(var d=t.cap(f,2,n-3),h=0;hc&&(p=c);for(var v=t.cap(h,2,r-3),g=0,m=-2;m<=2;m++){var y=a[d+m];g+=y[v-2]+y[v-1]+y[v]+y[v+1]+y[v+2]}var _=g/25;t.thresholdBlock(e,p,l,_,i,s)}}},t.cap=function(e,t,r){return er?r:e},t.thresholdBlock=function(e,r,n,i,o,a){for(var s=0,u=n*o+r;sa&&(f=a);for(var l=0;ls&&(d=s);for(var h=0,p=255,v=0,g=0,m=f*i+d;gv&&(v=_)}if(v-p>t.MIN_DYNAMIC_RANGE)for(g++,m+=i;g>2*t.BLOCK_SIZE_POWER;if(v-p<=t.MIN_DYNAMIC_RANGE&&(w=p/2,c>0&&l>0)){var C=(u[c-1][l]+2*u[c][l-1]+u[c-1][l-1])/4;p>10,n[o]=s}return n},t.prototype.getRow=function(e,t){if(e<0||e>=this.getHeight())throw new s.default("Requested row is outside the image: "+e);var r=this.getWidth(),n=e*r;return null===t?t=this.buffer.slice(n,n+r):(t.length>16&255,v=h>>7&510,g=255&h;l[d]=(p+v+g)/4&255}c.luminances=l}else c.luminances=t;if(void 0===i&&(c.dataWidth=r),void 0===o&&(c.dataHeight=n),void 0===a&&(c.left=0),void 0===s&&(c.top=0),c.left+r>c.dataWidth||c.top+n>c.dataHeight)throw new u.default("Crop rectangle does not fit within image data.");return c}return i(t,e),t.prototype.getRow=function(e,t){if(e<0||e>=this.getHeight())throw new u.default("Requested row is outside the image: "+e);var r=this.getWidth();(null==t||t.lengthr||o+s>n)throw new u.default("Crop rectangle does not fit within image data.");return c&&f.reverseHorizontal(a,s),f}return i(t,e),t.prototype.getRow=function(e,t){if(e<0||e>=this.getHeight())throw new u.default("Requested row is outside the image: "+e);var r=this.getWidth();(null==t||t.length=10&&(s|=1<<1-c),1!==c&&(a=e.getNextSet(a),a=e.getNextUnset(a))}if(2!==r.length)throw new u.default;if(parseInt(r.toString())%4!==s)throw new u.default;return a},e.parseExtensionString=function(e){return 2!==e.length?null:new Map([[s.default.ISSUE_NUMBER,parseInt(e)]])},e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),i=r(20),o=r(8),a=r(3),s=r(10),u=r(0),c=function(){function e(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=[0,0,0,0],this.decodeRowStringBuffer=""}return e.prototype.decodeRow=function(t,r,i){var s=this.decodeRowStringBuffer,u=this.decodeMiddle(r,i,s),c=s.toString(),f=e.parseExtensionString(c),l=[new a.default((i[0]+i[1])/2,t),new a.default(u,t)],d=new o.default(c,null,0,l,n.default.UPC_EAN_EXTENSION,(new Date).getTime());return null!=f&&d.putAllMetadata(f),d},e.prototype.decodeMiddle=function(t,r,n){var o=this.decodeMiddleCounters;o[0]=0,o[1]=0,o[2]=0,o[3]=0;for(var a=t.getSize(),s=r[1],c=0,f=0;f<5&&s=10&&(c|=1<<4-f),4!==f&&(s=t.getNextSet(s),s=t.getNextUnset(s))}if(5!==n.length)throw new u.default;var p=this.determineCheckDigit(c);if(e.extensionChecksum(n.toString())!==p)throw new u.default;return s},e.extensionChecksum=function(e){for(var t=e.length,r=0,n=t-2;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-"0".charCodeAt(0);for(r*=3,n=t-1;n>=0;n-=2)r+=e.charAt(n).charCodeAt(0)-"0".charCodeAt(0);return(r*=3)%10},e.prototype.determineCheckDigit=function(e){for(var t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new u.default},e.parseExtensionString=function(t){if(5!==t.length)return null;var r=e.parseExtension5String(t);return null==r?null:new Map([[s.default.SUGGESTED_PRICE,r]])},e.parseExtension5String=function(e){var t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}var r=parseInt(e.substring(1)),n=r%100;return t+(r/100).toString()+"."+(n<10?"0"+n:n.toString())},e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(20),i=r(73),o=r(72),a=function(){function e(){}return e.decodeRow=function(e,t,r){var a=n.default.findGuardPattern(t,r,!1,this.EXTENSION_START_PATTERN,new Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new i.default).decodeRow(e,t,a)}catch(r){return(new o.default).decodeRow(e,t,a)}},e.EXTENSION_START_PATTERN=[1,1,2],e}();t.default=a},function(e,t,r){"use strict";var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),a=r(9),s=r(45),u=r(0),c=function(e){function t(t){var r=e.call(this)||this,n=null==t?null:t.get(2),i=[];return null!=n&&n.indexOf(o.default.EAN_13)>-1&&i.push(new s.default),0===i.length&&i.push(new s.default),r.readers=i,r}return i(t,e),t.prototype.decodeRow=function(e,t,r){for(var n=0,i=this.readers;n0;){for(6===u&&(u-=1);c>=0&&c=n;)t^=r<=0)for(var u=0;u!==a;u++){var c=i[u];c>=0&&e.isEmpty(r.get(c,s))&&e.embedPositionAdjustmentPattern(c-2,s-2,r)}}},e.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),e.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),e.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),e.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),e.VERSION_INFO_POLY=7973,e.TYPE_INFO_POLY=1335,e.TYPE_INFO_MASK_PATTERN=21522,e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(41),i=r(12),o=function(){function e(e,t){this.width=e,this.height=t;for(var r=new Array(t),n=0;n!==t;n++)r[n]=new Uint8Array(e);this.bytes=r}return e.prototype.getHeight=function(){return this.height},e.prototype.getWidth=function(){return this.width},e.prototype.get=function(e,t){return this.bytes[t][e]},e.prototype.getArray=function(){return this.bytes},e.prototype.setNumber=function(e,t,r){this.bytes[t][e]=r},e.prototype.setBoolean=function(e,t,r){this.bytes[t][e]=r?1:0},e.prototype.clear=function(e){for(var t=0,r=this.bytes;t=7*(I+=2)||4*I>=7*O)null==(A=this.correctTopRightRectangular(v,E,b,S,O,I))&&(A=S),1==(1&(O=this.transitionsBetween(b,A).getTransitions()))&&O++,1==(1&(I=this.transitionsBetween(E,A).getTransitions()))&&I++,T=e.sampleGrid(this.image,b,v,E,A,O,I);else{var R=Math.min(I,O);null==(A=this.correctTopRight(v,E,b,S,R))&&(A=S);var P=Math.max(this.transitionsBetween(b,A).getTransitions(),this.transitionsBetween(E,A).getTransitions());1==(1&++P)&&P++,T=e.sampleGrid(this.image,b,v,E,A,P,P)}return new i.default(T,[b,v,E,A])},e.prototype.correctTopRightRectangular=function(t,r,i,o,a,s){var u=e.distance(t,r)/a,c=e.distance(i,o),f=(o.getX()-i.getX())/c,l=(o.getY()-i.getY())/c,d=new n.default(o.getX()+u*f,o.getY()+u*l);u=e.distance(t,i)/s,c=e.distance(r,o),f=(o.getX()-r.getX())/c,l=(o.getY()-r.getY())/c;var h=new n.default(o.getX()+u*f,o.getY()+u*l);return this.isValid(d)?this.isValid(h)?Math.abs(a-this.transitionsBetween(i,d).getTransitions())+Math.abs(s-this.transitionsBetween(r,d).getTransitions())<=Math.abs(a-this.transitionsBetween(i,h).getTransitions())+Math.abs(s-this.transitionsBetween(r,h).getTransitions())?d:h:d:this.isValid(h)?h:null},e.prototype.correctTopRight=function(t,r,i,o,a){var s=e.distance(t,r)/a,u=e.distance(i,o),c=(o.getX()-i.getX())/u,f=(o.getY()-i.getY())/u,l=new n.default(o.getX()+s*c,o.getY()+s*f);s=e.distance(t,i)/a,u=e.distance(r,o),c=(o.getX()-r.getX())/u,f=(o.getY()-r.getY())/u;var d=new n.default(o.getX()+s*c,o.getY()+s*f);return this.isValid(l)?this.isValid(d)?Math.abs(this.transitionsBetween(i,l).getTransitions()-this.transitionsBetween(r,l).getTransitions())<=Math.abs(this.transitionsBetween(i,d).getTransitions()-this.transitionsBetween(r,d).getTransitions())?l:d:l:this.isValid(d)?d:null},e.prototype.isValid=function(e){return e.getX()>=0&&e.getX()0&&e.getY()Math.abs(i-r);if(a){var s=r;r=n,n=s,s=i,i=o,o=s}for(var u=Math.abs(i-r),c=Math.abs(o-n),l=-u/2,d=n0){if(m===o)break;m+=d,l-=u}}return new f(e,t,p)},e}();t.default=c;var f=function(){function e(e,t,r){this.from=e,this.to=t,this.transitions=r}return e.prototype.getFrom=function(){return this.from},e.prototype.getTo=function(){return this.to},e.prototype.getTransitions=function(){return this.transitions},e.prototype.toString=function(){return this.from+"/"+this.to+"/"+this.transitions},e.resultPointsAndTransitionsComparator=function(e,t){return e.getTransitions()-t.getTransitions()},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=r(35),o=r(36),a=r(12),s=r(34),u=r(66),c=r(4),f=r(16);!function(e){e[e.PAD_ENCODE=0]="PAD_ENCODE",e[e.ASCII_ENCODE=1]="ASCII_ENCODE",e[e.C40_ENCODE=2]="C40_ENCODE",e[e.TEXT_ENCODE=3]="TEXT_ENCODE",e[e.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",e[e.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",e[e.BASE256_ENCODE=6]="BASE256_ENCODE"}(n||(n={}));var l=function(){function e(){}return e.decode=function(e){var t=new o.default(e),r=new a.default,s=new a.default,u=new Array,f=n.ASCII_ENCODE;do{if(f===n.ASCII_ENCODE)f=this.decodeAsciiSegment(t,r,s);else{switch(f){case n.C40_ENCODE:this.decodeC40Segment(t,r);break;case n.TEXT_ENCODE:this.decodeTextSegment(t,r);break;case n.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,r);break;case n.EDIFACT_ENCODE:this.decodeEdifactSegment(t,r);break;case n.BASE256_ENCODE:this.decodeBase256Segment(t,r,u);break;default:throw new c.default}f=n.ASCII_ENCODE}}while(f!==n.PAD_ENCODE&&t.available()>0);return s.length()>0&&r.append(s.toString()),new i.default(e,r.toString(),0===u.length?null:u,null)},e.decodeAsciiSegment=function(e,t,r){var i=!1;do{var o=e.readBits(8);if(0===o)throw new c.default;if(o<=128)return i&&(o+=128),t.append(String.fromCharCode(o-1)),n.ASCII_ENCODE;if(129===o)return n.PAD_ENCODE;if(o<=229){var a=o-130;a<10&&t.append("0"),t.append(""+a)}else switch(o){case 230:return n.C40_ENCODE;case 231:return n.BASE256_ENCODE;case 232:t.append(String.fromCharCode(29));break;case 233:case 234:break;case 235:i=!0;break;case 236:t.append("[)>05"),r.insert(0,"");break;case 237:t.append("[)>06"),r.insert(0,"");break;case 238:return n.ANSIX12_ENCODE;case 239:return n.TEXT_ENCODE;case 240:return n.EDIFACT_ENCODE;case 241:break;default:if(254!==o||0!==e.available())throw new c.default}}while(e.available()>0);return n.ASCII_ENCODE},e.decodeC40Segment=function(e,t){var r=!1,n=[],i=0;do{if(8===e.available())return;var o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),n);for(var a=0;a<3;a++){var s=n[a];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)},e.decodeTextSegment=function(e,t){var r=!1,n=[],i=0;do{if(8===e.available())return;var o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),n);for(var a=0;a<3;a++){var s=n[a];switch(i){case 0:if(s<3)i=s+1;else{if(!(s0)},e.decodeAnsiX12Segment=function(e,t){var r=[];do{if(8===e.available())return;var n=e.readBits(8);if(254===n)return;this.parseTwoBytes(n,e.readBits(8),r);for(var i=0;i<3;i++){var o=r[i];switch(o){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(o<14)t.append(String.fromCharCode(o+44));else{if(!(o<40))throw new c.default;t.append(String.fromCharCode(o+51))}}}}while(e.available()>0)},e.parseTwoBytes=function(e,t,r){var n=(e<<8)+t-1,i=Math.floor(n/1600);r[0]=i,n-=1600*i,i=Math.floor(n/40),r[1]=i,r[2]=n-40*i},e.decodeEdifactSegment=function(e,t){do{if(e.available()<=16)return;for(var r=0;r<4;r++){var n=e.readBits(6);if(31===n){var i=8-e.getBitOffset();return void(8!==i&&e.readBits(i))}0==(32&n)&&(n|=64),t.append(String.fromCharCode(n))}}while(e.available()>0)},e.decodeBase256Segment=function(e,t,r){var n,i=1+e.getByteOffset(),o=this.unrandomize255State(e.readBits(8),i++);if((n=0===o?e.available()/8|0:o<250?o:250*(o-249)+this.unrandomize255State(e.readBits(8),i++))<0)throw new c.default;for(var a=new Uint8Array(n),l=0;l=0?r:r+256},e.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],e.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],e.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],e.TEXT_SHIFT2_SET_CHARS=e.C40_SHIFT2_SET_CHARS,e.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)],e}();t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=function(){function e(e,t){this.numDataCodewords=e,this.codewords=t}return e.getDataBlocks=function(t,r){for(var i=r.getECBlocks(),o=0,a=i.getECBlocks(),s=0,u=a;s7?p-1:p;c[b].codewords[T]=t[_++]}if(_!==t.length)throw new n.default;return c},e.prototype.getNumDataCodewords=function(){return this.numDataCodewords},e.prototype.getCodewords=function(){return this.codewords},e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),i=function(){function e(e,t,r){this.ecCodewords=e,this.ecBlocks=[t],r&&this.ecBlocks.push(r)}return e.prototype.getECCodewords=function(){return this.ecCodewords},e.prototype.getECBlocks=function(){return this.ecBlocks},e}();t.ECBlocks=i;var o=function(){function e(e,t){this.count=e,this.dataCodewords=t}return e.prototype.getCount=function(){return this.count},e.prototype.getDataCodewords=function(){return this.dataCodewords},e}();t.ECB=o;var a=function(){function e(e,t,r,n,i,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=r,this.dataRegionSizeRows=n,this.dataRegionSizeColumns=i,this.ecBlocks=o;for(var a=0,s=o.getECCodewords(),u=0,c=o.getECBlocks();u144||0!=(1&r))throw new o.default;this.version=e.readVersion(t),this.mappingBitMatrix=this.extractDataRegion(t),this.readMappingMatrix=new n.default(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}return e.prototype.getVersion=function(){return this.version},e.readVersion=function(e){var t=e.getHeight(),r=e.getWidth();return i.default.getVersionForDimensions(t,r)},e.prototype.readCodewords=function(){var e=new Int8Array(this.version.getTotalCodewords()),t=0,r=4,n=0,i=this.mappingBitMatrix.getHeight(),a=this.mappingBitMatrix.getWidth(),s=!1,u=!1,c=!1,f=!1;do{if(r!==i||0!==n||s)if(r!==i-2||0!==n||0==(3&a)||u)if(r!==i+4||2!==n||0!=(7&a)||c)if(r!==i-2||0!==n||4!=(7&a)||f){do{r=0&&!this.readMappingMatrix.get(n,r)&&(e[t++]=255&this.readUtah(r,n,i,a)),r-=2,n+=2}while(r>=0&&n=0&&n=0);r+=3,n+=1}else e[t++]=255&this.readCorner4(i,a),r-=2,n+=2,f=!0;else e[t++]=255&this.readCorner3(i,a),r-=2,n+=2,c=!0;else e[t++]=255&this.readCorner2(i,a),r-=2,n+=2,u=!0;else e[t++]=255&this.readCorner1(i,a),r-=2,n+=2,s=!0}while(r=r)return!1;return!0},e.prototype.crossCheckVertical=function(t,r,n,i){var o=this.image,a=o.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;for(var u=t;u>=0&&o.get(r,u)&&s[1]<=n;)s[1]++,u--;if(u<0||s[1]>n)return NaN;for(;u>=0&&!o.get(r,u)&&s[0]<=n;)s[0]++,u--;if(s[0]>n)return NaN;for(u=t+1;un)return NaN;for(;un)return NaN;var c=s[0]+s[1]+s[2];return 5*Math.abs(c-i)>=2*i?NaN:this.foundPatternCross(s)?e.centerFromEnd(s,u):NaN},e.prototype.handlePossibleCenter=function(t,r,i){var o=t[0]+t[1]+t[2],a=e.centerFromEnd(t,i),s=this.crossCheckVertical(r,a,2*t[1],o);if(!isNaN(s)){for(var u=(t[0]+t[1]+t[2])/3,c=0,f=this.possibleCenters;cl[2]&&(d+=v-l[2]-c,p=u-1)}h=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,h=3;else l[++h]++;else l[h]++;e.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,d,u,i)&&(c=l[0],this.hasSkipped&&(f=this.haveMultiplyConfirmedCenters()))}var g=this.selectBestPatterns();return n.default.orderBestPatterns(g),new o.default(g)},e.centerFromEnd=function(e,t){return t-e[4]-e[3]-e[2]/2},e.foundPatternCross=function(e){for(var t=0,r=0;r<5;r++){var n=e[r];if(0===n)return!1;t+=n}if(t<7)return!1;var i=t/7,o=i/2;return Math.abs(i-e[0])=a&&r>=a&&s.get(r-a,t-a);)o[2]++,a++;if(t=a&&r>=a&&!s.get(r-a,t-a)&&o[1]<=n;)o[1]++,a++;if(tn)return!1;for(;t>=a&&r>=a&&s.get(r-a,t-a)&&o[0]<=n;)o[0]++,a++;if(o[0]>n)return!1;var u=s.getHeight(),c=s.getWidth();for(a=1;t+a=u||r+a>=c)return!1;for(;t+a=u||r+a>=c||o[3]>=n)return!1;for(;t+a=n)return!1;var f=o[0]+o[1]+o[2]+o[3]+o[4];return Math.abs(f-i)<2*i&&e.foundPatternCross(o)},e.prototype.crossCheckVertical=function(t,r,n,i){for(var o=this.image,a=o.getHeight(),s=this.getCrossCheckStateCount(),u=t;u>=0&&o.get(r,u);)s[2]++,u--;if(u<0)return NaN;for(;u>=0&&!o.get(r,u)&&s[1]<=n;)s[1]++,u--;if(u<0||s[1]>n)return NaN;for(;u>=0&&o.get(r,u)&&s[0]<=n;)s[0]++,u--;if(s[0]>n)return NaN;for(u=t+1;u=n)return NaN;for(;u=n)return NaN;var c=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(c-i)>=2*i?NaN:e.foundPatternCross(s)?e.centerFromEnd(s,u):NaN},e.prototype.crossCheckHorizontal=function(t,r,n,i){for(var o=this.image,a=o.getWidth(),s=this.getCrossCheckStateCount(),u=t;u>=0&&o.get(u,r);)s[2]++,u--;if(u<0)return NaN;for(;u>=0&&!o.get(u,r)&&s[1]<=n;)s[1]++,u--;if(u<0||s[1]>n)return NaN;for(;u>=0&&o.get(u,r)&&s[0]<=n;)s[0]++,u--;if(s[0]>n)return NaN;for(u=t+1;u=n)return NaN;for(;u=n)return NaN;var c=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(c-i)>=i?NaN:e.foundPatternCross(s)?e.centerFromEnd(s,u):NaN},e.prototype.handlePossibleCenter=function(t,r,n,o){var a=t[0]+t[1]+t[2]+t[3]+t[4],s=e.centerFromEnd(t,n),u=this.crossCheckVertical(r,Math.floor(s),t[2],a);if(!isNaN(u)&&(s=this.crossCheckHorizontal(Math.floor(s),Math.floor(u),t[2],a),!isNaN(s)&&(!o||this.crossCheckDiagonal(Math.floor(u),Math.floor(s),t[2],a)))){for(var c=a/7,f=!1,l=this.possibleCenters,d=0,h=l.length;d=e.CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-i.getX())-Math.abs(t.getY()-i.getY()))/2);t=i}}return 0},e.prototype.haveMultiplyConfirmedCenters=function(){for(var t=0,r=0,n=this.possibleCenters.length,i=0,o=this.possibleCenters;i=e.CENTER_QUORUM&&(t++,r+=f.getEstimatedModuleSize());if(t<3)return!1;for(var a=r/n,s=0,u=0,c=this.possibleCenters;u3){for(var n=0,i=0,o=0,s=this.possibleCenters;oi?1:0});for(var f=Math.max(.2*t,c),l=0;l3;l++){var d=r[l];Math.abs(d.getEstimatedModuleSize()-t)>f&&(r.splice(l,1),l--)}}if(r.length>3){n=0;for(var h=0,p=r;hi?-1:0}return r.getCount()-e.getCount()}),r.splice(3)}return[r[0],r[1],r[2]]},e.CENTER_QUORUM=2,e.MIN_SKIP=3,e.MAX_MODULES=57,e}();t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),i=r(33),o=r(32),a=r(31),s=r(17),u=r(37),c=r(92),f=r(89),l=r(0),d=function(){function e(e){this.image=e}return e.prototype.getImage=function(){return this.image},e.prototype.getResultPointCallback=function(){return this.resultPointCallback},e.prototype.detect=function(e){this.resultPointCallback=null==e?null:e.get(9);var t=new c.default(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)},e.prototype.processFinderPatternInfo=function(t){var r=t.getTopLeft(),n=t.getTopRight(),o=t.getBottomLeft(),a=this.calculateModuleSize(r,n,o);if(a<1)throw new l.default("No pattern found in proccess finder.");var s=e.computeDimension(r,n,o,a),c=u.default.getProvisionalVersionForDimension(s),f=c.getDimensionForVersion()-7,d=null;if(c.getAlignmentPatternCenters().length>0)for(var h=n.getX()-r.getX()+o.getX(),p=n.getY()-r.getY()+o.getY(),v=1-3/f,g=Math.floor(r.getX()+v*(h-r.getX())),m=Math.floor(r.getY()+v*(p-r.getY())),y=4;y<=16;y<<=1)try{d=this.findAlignmentInRegion(a,g,m,y);break}catch(e){if(!(e instanceof l.default))throw e}var _,w=e.createTransform(r,n,o,d,s),C=e.sampleGrid(this.image,w,s);return _=null===d?[o,r,n]:[o,r,n,d],new i.default(C,_)},e.createTransform=function(e,t,r,n,i){var o,s,u,c,f=i-3.5;return null!==n?(o=n.getX(),s=n.getY(),c=u=f-3):(o=t.getX()-e.getX()+r.getX(),s=t.getY()-e.getY()+r.getY(),u=f,c=f),a.default.quadrilateralToQuadrilateral(3.5,3.5,f,3.5,u,c,3.5,f,e.getX(),e.getY(),t.getX(),t.getY(),o,s,r.getX(),r.getY())},e.sampleGrid=function(e,t,r){return o.default.getInstance().sampleGridWithTransform(e,r,r,t)},e.computeDimension=function(e,t,r,i){var o=s.default.round(n.default.distance(e,t)/i),a=s.default.round(n.default.distance(e,r)/i),u=Math.floor((o+a)/2)+7;switch(3&u){case 0:u++;break;case 2:u--;break;case 3:throw new l.default("Dimensions could be not found.")}return u},e.prototype.calculateModuleSize=function(e,t,r){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,r))/2},e.prototype.calculateModuleSizeOneWay=function(e,t){var r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(r)?n/7:isNaN(n)?r/7:(r+n)/14},e.prototype.sizeOfBlackWhiteBlackRunBothWays=function(e,t,r,n){var i=this.sizeOfBlackWhiteBlackRun(e,t,r,n),o=1,a=e-(r-e);a<0?(o=e/(e-a),a=0):a>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(a-e),a=this.image.getWidth()-1);var s=Math.floor(t-(n-t)*o);return o=1,s<0?(o=t/(t-s),s=0):s>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(s-t),s=this.image.getHeight()-1),a=Math.floor(e+(a-e)*o),(i+=this.sizeOfBlackWhiteBlackRun(e,t,a,s))-1},e.prototype.sizeOfBlackWhiteBlackRun=function(e,t,r,n){var i=Math.abs(n-t)>Math.abs(r-e);if(i){var o=e;e=t,t=o,o=r,r=n,n=o}for(var a=Math.abs(r-e),u=Math.abs(n-t),c=-a/2,f=e0){if(v===n)break;v+=l,c-=a}}return 2===d?s.default.distance(r+f,n,e,t):NaN},e.prototype.findAlignmentInRegion=function(e,t,r,n){var i=Math.floor(n*e),o=Math.max(0,t-i),a=Math.min(this.image.getWidth()-1,t+i);if(a-o<3*e)throw new l.default("Alignment top exceeds estimated module size.");var s=Math.max(0,r-i),u=Math.min(this.image.getHeight()-1,r+i);if(u-s<3*e)throw new l.default("Alignment bottom exceeds estimated module size.");return new f.default(this.image,o,s,a-o,u-s,e,this.resultPointCallback).find()},e}();t.default=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(36),i=r(15),o=r(35),a=r(55),s=r(54),u=r(12),c=r(34),f=r(4),l=function(){function e(){}return e.decode=function(t,r,a,c){var l=new n.default(t),d=new u.default,h=new Array,p=-1,v=-1;try{var g=null,m=!1,y=void 0;do{if(l.available()<4)y=s.default.TERMINATOR;else{var _=l.readBits(4);y=s.default.forBits(_)}switch(y){case s.default.TERMINATOR:break;case s.default.FNC1_FIRST_POSITION:case s.default.FNC1_SECOND_POSITION:m=!0;break;case s.default.STRUCTURED_APPEND:if(l.available()<16)throw new f.default;p=l.readBits(8),v=l.readBits(8);break;case s.default.ECI:var w=e.parseECIValue(l);if(null===(g=i.default.getCharacterSetECIByValue(w)))throw new f.default;break;case s.default.HANZI:var C=l.readBits(4),E=l.readBits(y.getCharacterCountBits(r));C===e.GB2312_SUBSET&&e.decodeHanziSegment(l,d,E);break;default:var S=l.readBits(y.getCharacterCountBits(r));switch(y){case s.default.NUMERIC:e.decodeNumericSegment(l,d,S);break;case s.default.ALPHANUMERIC:e.decodeAlphanumericSegment(l,d,S,m);break;case s.default.BYTE:e.decodeByteSegment(l,d,S,g,h,c);break;case s.default.KANJI:e.decodeKanjiSegment(l,d,S);break;default:throw new f.default}}}while(y!==s.default.TERMINATOR)}catch(e){throw new f.default}return new o.default(t,d.toString(),0===h.length?null:h,null===a?null:a.toString(),p,v)},e.decodeHanziSegment=function(e,t,r){if(13*r>e.available())throw new f.default;for(var n=new Uint8Array(2*r),i=0;r>0;){var o=e.readBits(13),s=o/96<<8&4294967295|o%96;s+=s<959?41377:42657,n[i]=s>>8&255,n[i+1]=255&s,i+=2,r--}try{t.append(c.default.decode(n,a.default.GB2312))}catch(e){throw new f.default(e)}},e.decodeKanjiSegment=function(e,t,r){if(13*r>e.available())throw new f.default;for(var n=new Uint8Array(2*r),i=0;r>0;){var o=e.readBits(13),s=o/192<<8&4294967295|o%192;s+=s<7936?33088:49472,n[i]=s>>8,n[i+1]=s,i+=2,r--}try{t.append(c.default.decode(n,a.default.SHIFT_JIS))}catch(e){throw new f.default(e)}},e.decodeByteSegment=function(e,t,r,n,i,o){if(8*r>e.available())throw new f.default;for(var s,u=new Uint8Array(r),l=0;l=e.ALPHANUMERIC_CHARS.length)throw new f.default;return e.ALPHANUMERIC_CHARS[t]},e.decodeAlphanumericSegment=function(t,r,n,i){for(var o=r.length();n>1;){if(t.available()<11)throw new f.default;var a=t.readBits(11);r.append(e.toAlphaNumericChar(Math.floor(a/45))),r.append(e.toAlphaNumericChar(a%45)),n-=2}if(1===n){if(t.available()<6)throw new f.default;r.append(e.toAlphaNumericChar(t.readBits(6)))}if(i)for(var s=o;s=3;){if(t.available()<10)throw new f.default;var i=t.readBits(10);if(i>=1e3)throw new f.default;r.append(e.toAlphaNumericChar(Math.floor(i/100))),r.append(e.toAlphaNumericChar(Math.floor(i/10)%10)),r.append(e.toAlphaNumericChar(i%10)),n-=3}if(2===n){if(t.available()<7)throw new f.default;var o=t.readBits(7);if(o>=100)throw new f.default;r.append(e.toAlphaNumericChar(Math.floor(o/10))),r.append(e.toAlphaNumericChar(o%10))}else if(1===n){if(t.available()<4)throw new f.default;var a=t.readBits(4);if(a>=10)throw new f.default;r.append(e.toAlphaNumericChar(a))}},e.parseECIValue=function(e){var t=e.readBits(8);if(0==(128&t))return 127&t;if(128==(192&t))return(63&t)<<8&4294967295|e.readBits(8);if(192==(224&t))return(31&t)<<16&4294967295|e.readBits(16);throw new f.default},e.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",e.GB2312_SUBSET=1,e}();t.default=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=function(){function e(e,t){this.numDataCodewords=e,this.codewords=t}return e.getDataBlocks=function(t,r,i){if(t.length!==r.getTotalCodewords())throw new n.default;for(var o=r.getECBlocksForLevel(i),a=0,s=o.getECBlocks(),u=0,c=s;u=0&&f[_].codewords.length!==y;)_--;_++;var w=y-o.getECCodewordsPerBlock(),C=0;for(v=0;v=0;r--)e=this.copyBit(8,r,e);var n=this.bitMatrix.getHeight(),o=0,s=n-7;for(r=n-1;r>=s;r--)o=this.copyBit(8,r,o);for(t=n-8;t=0;o--)for(var s=e-9;s>=i;s--)r=this.copyBit(s,o,r);var u=n.default.decodeVersionInformation(r);if(null!==u&&u.getDimensionForVersion()===e)return this.parsedVersion=u,u;for(r=0,s=5;s>=0;s--)for(o=e-9;o>=i;o--)r=this.copyBit(s,o,r);if(null!==(u=n.default.decodeVersionInformation(r))&&u.getDimensionForVersion()===e)return this.parsedVersion=u,u;throw new a.default},e.prototype.copyBit=function(e,t,r){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?r<<1|1:r<<1},e.prototype.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),r=o.default.values.get(e.getDataMask()),n=this.bitMatrix.getHeight();r.unmaskBitMatrix(this.bitMatrix,n);for(var i=t.buildFunctionPattern(),s=!0,u=new Uint8Array(t.getTotalCodewords()),c=0,f=0,l=0,d=n-1;d>0;d-=2){6===d&&d--;for(var h=0;h1)for(var r=1;r0&&s.length>o){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else s=a[t]=r,++e._eventsCount;return e}function d(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(r=a[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=g(e,n),o=0;o=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,o=a;break}if(o<0)return this;0===o?r.shift():function(e,t){for(var r=t,n=r+1,i=e.length;n=0;o--)this.removeListener(e,t[o]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},a.prototype.listenerCount=v,a.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],4:[function(e,t,r){function n(e,t){Error.captureStackTrace(this,this.constructor),this.name="FsmError",this.message=e,this.trigger=t.name,this.current=t.from}t.exports=n,n.prototype=Object.create(Error.prototype),n.prototype.constructor=n},{}],5:[function(e,t,r){(function(r){"use strict";var n=e("./fsm-error"),i=e("stampit"),o=e("lodash"),a=e("events").EventEmitter,s=i({init:function(e){Object.assign(this,e)}}),u=i({props:{events:[],pseudoStates:{},responses:{},pseudoEvents:{},callbacks:{},states:{},final:null,initial:"none",current:"none"},statics:{Promise:r.Promise||e("es6-promise").Promise,FsmError:n,callbackPrefix:"on",noChoiceFound:"no-choice",type:function(e){var t=this.Type;return e.from===e.to||o.isUndefined(e.to)?t.NOOP:"*"===e.from?t.GENERAL:t.INTER},Type:{NOOP:0,INTER:1,GENERAL:2},isConditional:function(e){return o.isFunction(e.condition)&&o.isArray(e.to)},pseudoEvent:function(e,t){return e+"--"+t}},methods:{emit:o.noop,canTransition:function(e){var t=this.factory,r=t.Type;switch(t.type(e)){case r.NOOP:if(this.inTransition)throw new t.FsmError("Previous transition pending",e);break;case r.INTER:if(this.states[this.current].noopTransition>0||this.inTransition)throw new t.FsmError("Previous transition pending",e)}return e},can:function(e){return Boolean(this.events[e][this.current])},cannot:function(e){return!this.can(e)},hasState:function(e){return Boolean(this.states[e])},is:function(e){return e==this.current},isFinal:function(e){return e=e||this.current,o.isArray(this.final)?o.includes(this.final,e):this.final===e},isValidEvent:function(e){if(this.cannot(e.name))throw new this.factory.FsmError("Invalid event in current state",e);return e},addEvents:function(e){o.forEach(e,function(e){this.addEvent(e)}.bind(this))},addEvent:function(e){if(this.events[e.name]=this.events[e.name]||{},this.factory.isConditional(e))return this.addConditionalEvent(e);this.addBasicEvent(e)},addBasicEvent:function(e){if(o.isArray(e.to))throw new this.factory.FsmError("Ambigous transition",e);e.from=[].concat(e.from||[]),o.forEach(e.from,function(t){this.events[e.name][t]=e.to||t}.bind(this))},addConditionalEvent:function(e){var t,r=this.factory,n=r.callbackPrefix,i=r.noChoiceFound,a=r.pseudoEvent,s=r.Promise;if(o.isArray(e.from))return o.forEach(e.from,function(t){this.addConditionalEvent({name:e.name,from:t,to:e.to,condition:e.condition})}.bind(this));t=e.from+"__"+e.name,this.pseudoStates[t]=e.from,this.addState(t),this.addEvent({name:e.name,from:e.from,to:t}),this.addEvent({name:a(t,i),from:t,to:e.from}),this.pseudoEvents[a(t,i)]=e.name,o.forEach(e.to,function(r){this.addEvent({name:a(t,r),from:t,to:r}),this.pseudoEvents[a(t,r)]=e.name}.bind(this)),this.callbacks[n+"entered"+t]=function(n){var u=this.target;return o.defaults(n,{args:[]}),new s(function(t){t(e.condition(n))}).then(function(s){var c;return o.isNumber(s)?c=e.to[s]:o.includes(e.to,s)&&(c=s),o.isUndefined(c)?u[a(t,i)]().then(function(){throw new r.FsmError("Choice index out of range",e)}):u[a(t,c)].apply(u,n.args)}.bind(this))}.bind(this)},addState:function(e){var t=this.states;(e=[].concat(e||[])).forEach(function(e){t[e]=t[e]||{noopTransition:0}})},preprocessPseudoState:function(e,t){var r=this.responses;return Object.defineProperty(t,"res",{get:function(){return r[e]},set:function(t){r[e]=t}}),delete r[e],t},preprocessPseudoEvent:function(e,t){var r=this.pseudoEvents[e],n=this.responses,i=this.pseudoStates,o={name:r,from:i[this.current],to:t.to,args:t.args};return Object.defineProperties(o,{res:{get:function(){return n[r]},set:function(e){n[r]=e}}}),o},buildEvent:function(e){var t=this.callbacks,r=this.pseudoEvents,n=this.pseudoStates,i=this.events,a=this.factory.Type,s=this.factory.callbackPrefix;return function(){var u,c=o.toArray(arguments),f=this.current,l=this.target,d={name:e,from:f,to:i[e][f],args:c},h=r[e];return n[d.to]&&(d=this.preprocessPseudoState(e,d)),h&&(u=this.preprocessPseudoEvent(e,d)),new this.factory.Promise(function(e){e(d)}).then(this.isValidEvent.bind(this)).then(this.canTransition.bind(this)).then(t[s+"leave"+f]?t[s+"leave"+f].bind(l,d):o.identity).then(t.onleave?t.onleave.bind(l,d):o.identity).then(function(e){switch(this.factory.type(e)){case a.NOOP:this.states[this.current].noopTransition+=1;break;default:this.inTransition=!0}return e}.bind(this,d)).then(t[s+e]?t[s+e].bind(l,d):o.identity).then(t[s+"enter"+i[e][f]]?t[s+"enter"+i[e][f]].bind(l,h?u:d):o.identity).then(t.onenter?t.onenter.bind(l,h?u:d):o.identity).then(function(e){switch(this.factory.type(e)){case a.NOOP:this.states[this.current].noopTransition-=1;break;default:this.inTransition=!1,this.current=e.to,this.emit("state",this.current)}return e}.bind(this,d)).then(t[s+"entered"+i[e][f]]?t[s+"entered"+i[e][f]].bind(l,h?u:d):o.identity).then(t.onentered?t.onentered.bind(l,h?u:d):o.identity).then(function(e){return e.res||e}.bind(this,d)).catch(function(e){switch(this.factory.type(d)){case a.INTER:this.inTransition=!1;break;case a.NOOP:this.states[this.current].noopTransition>0&&(this.states[this.current].noopTransition-=1)}throw e}.bind(this))}.bind(this)},initTarget:function(e){var t;return o.isObject(e)||(e=new a),o.isFunction(e.emit)&&(this.emit=function(){return e.emit.apply(e,arguments)}),t=o.mapValues(this.events,function(e,t){return this.buildEvent(t)}.bind(this)),o.assign(e,t,{can:this.can.bind(this),cannot:this.cannot.bind(this),is:this.is.bind(this),hasState:this.hasState.bind(this),isFinal:this.isFinal.bind(this)}),Object.defineProperty(e,"current",{get:function(){return this.current}.bind(this)}),this.target=e,e}},init:function(e,t){this.factory=t.stamp;var r=this.events;return this.events={},o.forEach(r,function(e,t){o.isString(t)&&(e.name=t),this.addEvent(e),this.addState(e.from),this.addState(e.to)}.bind(this)),this.current=this.initial,this.initTarget(t.args[1])}});u=s.compose(u),t.exports=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./fsm-error":4,"es6-promise":2,events:3,lodash:6,stampit:11}],11:[function(e,t,r){"use strict";function n(e,t){if(void 0===t)return e;if(u(t))return(u(e)?e:[]).concat(t);if(!c(t))return t;for(var r=a(e)?e:{},i=Object.keys(t),o=0;o0;)t[r]=arguments[r+1];return t.reduce(n,e)};function o(e){return"function"==typeof e}function a(e){var t=typeof e;return!!e&&("object"===t||"function"===t)}var s=Object.assign||function(e){for(var t=arguments,r=1;r0;)n[a]=arguments[a+1];var u=Object.create(e.methods||null);if(i(u,e.deepProperties),s(u,e.properties),Object.defineProperties(u,e.propertyDescriptors||{}),!e.initializers||0===e.initializers.length)return u;void 0===r&&(r={});for(var c=e.initializers,f=c.length,l=0;l0){for(var s=[],c=0;c>>1,j=[["ary",E],["bind",v],["bindKey",g],["curry",y],["curryRight",_],["flip",b],["partial",w],["partialRight",C],["rearg",S]],F="[object Arguments]",U="[object Array]",z="[object AsyncFunction]",V="[object Boolean]",G="[object Date]",H="[object DOMException]",W="[object Error]",X="[object Function]",Y="[object GeneratorFunction]",K="[object Map]",Z="[object Number]",q="[object Null]",J="[object Object]",Q="[object Proxy]",$="[object RegExp]",ee="[object Set]",te="[object String]",re="[object Symbol]",ne="[object Undefined]",ie="[object WeakMap]",oe="[object WeakSet]",ae="[object ArrayBuffer]",se="[object DataView]",ue="[object Float32Array]",ce="[object Float64Array]",fe="[object Int8Array]",le="[object Int16Array]",de="[object Int32Array]",he="[object Uint8Array]",pe="[object Uint8ClampedArray]",ve="[object Uint16Array]",ge="[object Uint32Array]",me=/\b__p \+= '';/g,ye=/\b(__p \+=) '' \+/g,_e=/(__e\(.*?\)|\b__t\)) \+\n'';/g,we=/&(?:amp|lt|gt|quot|#39);/g,Ce=/[&<>"']/g,Ee=RegExp(we.source),Se=RegExp(Ce.source),be=/<%-([\s\S]+?)%>/g,Te=/<%([\s\S]+?)%>/g,Ae=/<%=([\s\S]+?)%>/g,Oe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ie=/^\w*$/,Re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Pe=/[\\^$.*+?()[\]{}|]/g,Me=RegExp(Pe.source),Ne=/^\s+|\s+$/g,De=/^\s+/,ke=/\s+$/,xe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Be=/\{\n\/\* \[wrapped with (.+)\] \*/,Le=/,? & /,je=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Fe=/\\(\\)?/g,Ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ze=/\w*$/,Ve=/^[-+]0x[0-9a-f]+$/i,Ge=/^0b[01]+$/i,He=/^\[object .+?Constructor\]$/,We=/^0o[0-7]+$/i,Xe=/^(?:0|[1-9]\d*)$/,Ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ke=/($^)/,Ze=/['\n\r\u2028\u2029\\]/g,qe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Je="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Qe="[\\ud800-\\udfff]",$e="["+Je+"]",et="["+qe+"]",tt="\\d+",rt="[\\u2700-\\u27bf]",nt="[a-z\\xdf-\\xf6\\xf8-\\xff]",it="[^\\ud800-\\udfff"+Je+tt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ot="\\ud83c[\\udffb-\\udfff]",at="[^\\ud800-\\udfff]",st="(?:\\ud83c[\\udde6-\\uddff]){2}",ut="[\\ud800-\\udbff][\\udc00-\\udfff]",ct="[A-Z\\xc0-\\xd6\\xd8-\\xde]",ft="(?:"+nt+"|"+it+")",lt="(?:"+ct+"|"+it+")",dt="(?:"+et+"|"+ot+")"+"?",ht="[\\ufe0e\\ufe0f]?"+dt+("(?:\\u200d(?:"+[at,st,ut].join("|")+")[\\ufe0e\\ufe0f]?"+dt+")*"),pt="(?:"+[rt,st,ut].join("|")+")"+ht,vt="(?:"+[at+et+"?",et,st,ut,Qe].join("|")+")",gt=RegExp("['’]","g"),mt=RegExp(et,"g"),yt=RegExp(ot+"(?="+ot+")|"+vt+ht,"g"),_t=RegExp([ct+"?"+nt+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[$e,ct,"$"].join("|")+")",lt+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[$e,ct+ft,"$"].join("|")+")",ct+"?"+ft+"+(?:['’](?:d|ll|m|re|s|t|ve))?",ct+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt,pt].join("|"),"g"),wt=RegExp("[\\u200d\\ud800-\\udfff"+qe+"\\ufe0e\\ufe0f]"),Ct=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Et=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],St=-1,bt={};bt[ue]=bt[ce]=bt[fe]=bt[le]=bt[de]=bt[he]=bt[pe]=bt[ve]=bt[ge]=!0,bt[F]=bt[U]=bt[ae]=bt[V]=bt[se]=bt[G]=bt[W]=bt[X]=bt[K]=bt[Z]=bt[J]=bt[$]=bt[ee]=bt[te]=bt[ie]=!1;var Tt={};Tt[F]=Tt[U]=Tt[ae]=Tt[se]=Tt[V]=Tt[G]=Tt[ue]=Tt[ce]=Tt[fe]=Tt[le]=Tt[de]=Tt[K]=Tt[Z]=Tt[J]=Tt[$]=Tt[ee]=Tt[te]=Tt[re]=Tt[he]=Tt[pe]=Tt[ve]=Tt[ge]=!0,Tt[W]=Tt[X]=Tt[ie]=!1;var At={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ot=parseFloat,It=parseInt,Rt="object"==typeof e&&e&&e.Object===Object&&e,Pt="object"==typeof self&&self&&self.Object===Object&&self,Mt=Rt||Pt||Function("return this")(),Nt="object"==typeof r&&r&&!r.nodeType&&r,Dt=Nt&&"object"==typeof t&&t&&!t.nodeType&&t,kt=Dt&&Dt.exports===Nt,xt=kt&&Rt.process,Bt=function(){try{var e=Dt&&Dt.require&&Dt.require("util").types;return e||xt&&xt.binding&&xt.binding("util")}catch(e){}}(),Lt=Bt&&Bt.isArrayBuffer,jt=Bt&&Bt.isDate,Ft=Bt&&Bt.isMap,Ut=Bt&&Bt.isRegExp,zt=Bt&&Bt.isSet,Vt=Bt&&Bt.isTypedArray;function Gt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Ht(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i-1}function qt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function yr(e,t){for(var r=e.length;r--&&or(t,e[r],0)>-1;);return r}var _r=fr({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),wr=fr({"&":"&","<":"<",">":">",'"':""","'":"'"});function Cr(e){return"\\"+At[e]}function Er(e){return wt.test(e)}function Sr(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function br(e,t){return function(r){return e(t(r))}}function Tr(e,t){for(var r=-1,n=e.length,i=0,o=[];++r",""":'"',"'":"'"});var Mr=function e(t){var r,qe=(t=null==t?Mt:Mr.defaults(Mt.Object(),t,Mr.pick(Mt,Et))).Array,Je=t.Date,Qe=t.Error,$e=t.Function,et=t.Math,tt=t.Object,rt=t.RegExp,nt=t.String,it=t.TypeError,ot=qe.prototype,at=$e.prototype,st=tt.prototype,ut=t["__core-js_shared__"],ct=at.toString,ft=st.hasOwnProperty,lt=0,dt=(r=/[^.]+$/.exec(ut&&ut.keys&&ut.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",ht=st.toString,pt=ct.call(tt),vt=Mt._,yt=rt("^"+ct.call(ft).replace(Pe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wt=kt?t.Buffer:n,At=t.Symbol,Rt=t.Uint8Array,Pt=wt?wt.allocUnsafe:n,Nt=br(tt.getPrototypeOf,tt),Dt=tt.create,xt=st.propertyIsEnumerable,Bt=ot.splice,rr=At?At.isConcatSpreadable:n,fr=At?At.iterator:n,Nr=At?At.toStringTag:n,Dr=function(){try{var e=Fo(tt,"defineProperty");return e({},"",{}),e}catch(e){}}(),kr=t.clearTimeout!==Mt.clearTimeout&&t.clearTimeout,xr=Je&&Je.now!==Mt.Date.now&&Je.now,Br=t.setTimeout!==Mt.setTimeout&&t.setTimeout,Lr=et.ceil,jr=et.floor,Fr=tt.getOwnPropertySymbols,Ur=wt?wt.isBuffer:n,zr=t.isFinite,Vr=ot.join,Gr=br(tt.keys,tt),Hr=et.max,Wr=et.min,Xr=Je.now,Yr=t.parseInt,Kr=et.random,Zr=ot.reverse,qr=Fo(t,"DataView"),Jr=Fo(t,"Map"),Qr=Fo(t,"Promise"),$r=Fo(t,"Set"),en=Fo(t,"WeakMap"),tn=Fo(tt,"create"),rn=en&&new en,nn={},on=la(qr),an=la(Jr),sn=la(Qr),un=la($r),cn=la(en),fn=At?At.prototype:n,ln=fn?fn.valueOf:n,dn=fn?fn.toString:n;function hn(e){if(Is(e)&&!ms(e)&&!(e instanceof mn)){if(e instanceof gn)return e;if(ft.call(e,"__wrapped__"))return da(e)}return new gn(e)}var pn=function(){function e(){}return function(t){if(!Os(t))return{};if(Dt)return Dt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function vn(){}function gn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function mn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=x,this.__views__=[]}function yn(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function xn(e,t,r,i,o,a){var s,u=t&f,c=t&l,h=t&d;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!Os(e))return e;var p=ms(e);if(p){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&ft.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!u)return ro(e,s)}else{var v=Vo(e),g=v==X||v==Y;if(Cs(e))return qi(e,u);if(v==J||v==F||g&&!o){if(s=c||g?{}:Ho(e),!u)return c?function(e,t){return no(e,zo(e),t)}(e,function(e,t){return e&&no(t,ou(t),e)}(s,e)):function(e,t){return no(e,Uo(e),t)}(e,Mn(s,e))}else{if(!Tt[v])return o?e:{};s=function(e,t,r){var n,i,o,a=e.constructor;switch(t){case ae:return Ji(e);case V:case G:return new a(+e);case se:return function(e,t){var r=t?Ji(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case ue:case ce:case fe:case le:case de:case he:case pe:case ve:case ge:return Qi(e,r);case K:return new a;case Z:case te:return new a(e);case $:return(o=new(i=e).constructor(i.source,ze.exec(i))).lastIndex=i.lastIndex,o;case ee:return new a;case re:return n=e,ln?tt(ln.call(n)):{}}}(e,v,u)}}a||(a=new En);var m=a.get(e);if(m)return m;if(a.set(e,s),Ds(e))return e.forEach(function(n){s.add(xn(n,t,r,n,e,a))}),s;if(Rs(e))return e.forEach(function(n,i){s.set(i,xn(n,t,r,i,e,a))}),s;var y=p?n:(h?c?No:Mo:c?ou:iu)(e);return Wt(y||e,function(n,i){y&&(n=e[i=n]),In(s,i,xn(n,t,r,i,e,a))}),s}function Bn(e,t,r){var i=r.length;if(null==e)return!i;for(e=tt(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function Ln(e,t,r){if("function"!=typeof e)throw new it(a);return ia(function(){e.apply(n,r)},t)}function jn(e,t,r,n){var o=-1,a=Zt,s=!0,u=e.length,c=[],f=t.length;if(!u)return c;r&&(t=Jt(t,pr(r))),n?(a=qt,s=!1):t.length>=i&&(a=gr,s=!1,t=new Cn(t));e:for(;++o-1},_n.prototype.set=function(e,t){var r=this.__data__,n=Rn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},wn.prototype.clear=function(){this.size=0,this.__data__={hash:new yn,map:new(Jr||_n),string:new yn}},wn.prototype.delete=function(e){var t=Lo(this,e).delete(e);return this.size-=t?1:0,t},wn.prototype.get=function(e){return Lo(this,e).get(e)},wn.prototype.has=function(e){return Lo(this,e).has(e)},wn.prototype.set=function(e,t){var r=Lo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Cn.prototype.add=Cn.prototype.push=function(e){return this.__data__.set(e,s),this},Cn.prototype.has=function(e){return this.__data__.has(e)},En.prototype.clear=function(){this.__data__=new _n,this.size=0},En.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},En.prototype.get=function(e){return this.__data__.get(e)},En.prototype.has=function(e){return this.__data__.has(e)},En.prototype.set=function(e,t){var r=this.__data__;if(r instanceof _n){var n=r.__data__;if(!Jr||n.length0&&r(s)?t>1?Hn(s,t-1,r,n,i):Qt(i,s):n||(i[i.length]=s)}return i}var Wn=so(),Xn=so(!0);function Yn(e,t){return e&&Wn(e,t,iu)}function Kn(e,t){return e&&Xn(e,t,iu)}function Zn(e,t){return Kt(t,function(t){return bs(e[t])})}function qn(e,t){for(var r=0,i=(t=Xi(t,e)).length;null!=e&&rt}function ei(e,t){return null!=e&&ft.call(e,t)}function ti(e,t){return null!=e&&t in tt(e)}function ri(e,t,r){for(var i=r?qt:Zt,o=e[0].length,a=e.length,s=a,u=qe(a),c=1/0,f=[];s--;){var l=e[s];s&&t&&(l=Jt(l,pr(t))),c=Wr(l.length,c),u[s]=!r&&(t||o>=120&&l.length>=120)?new Cn(s&&l):n}l=e[0];var d=-1,h=u[0];e:for(;++d=s)return u;var c=r[n];return u*("desc"==c?-1:1)}}return e.index-t.index}(e,t,r)})}function yi(e,t,r){for(var n=-1,i=t.length,o={};++n-1;)s!==e&&Bt.call(s,u,1),Bt.call(e,u,1);return e}function wi(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;Xo(i)?Bt.call(e,i,1):ji(e,i)}}return e}function Ci(e,t){return e+jr(Kr()*(t-e+1))}function Ei(e,t){var r="";if(!e||t<1||t>N)return r;do{t%2&&(r+=e),(t=jr(t/2))&&(e+=e)}while(t);return r}function Si(e,t){return oa(ea(e,t,Pu),e+"")}function bi(e){return bn(hu(e))}function Ti(e,t){var r=hu(e);return ua(r,kn(t,0,r.length))}function Ai(e,t,r,i){if(!Os(e))return e;for(var o=-1,a=(t=Xi(t,e)).length,s=a-1,u=e;null!=u&&++oi?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=qe(i);++n>>1,a=e[o];null!==a&&!xs(a)&&(r?a<=t:a=i){var f=t?null:So(e);if(f)return Ar(f);s=!1,o=gr,c=new Cn}else c=t?[]:u;e:for(;++n=i?e:Pi(e,t,r)}var Zi=kr||function(e){return Mt.clearTimeout(e)};function qi(e,t){if(t)return e.slice();var r=e.length,n=Pt?Pt(r):new e.constructor(r);return e.copy(n),n}function Ji(e){var t=new e.constructor(e.byteLength);return new Rt(t).set(new Rt(e)),t}function Qi(e,t){var r=t?Ji(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function $i(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=xs(e),s=t!==n,u=null===t,c=t==t,f=xs(t);if(!u&&!f&&!a&&e>t||a&&s&&c&&!u&&!f||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!f&&e1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&Yo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=tt(t);++i-1?o[a?t[s]:s]:n}}function ho(e){return Po(function(t){var r=t.length,i=r,o=gn.prototype.thru;for(e&&t.reverse();i--;){var s=t[i];if("function"!=typeof s)throw new it(a);if(o&&!u&&"wrapper"==ko(s))var u=new gn([],!0)}for(i=u?i:r;++i1&&y.reverse(),l&&cu))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var l=-1,d=!0,v=r&p?new Cn:n;for(a.set(e,t),a.set(t,e);++l-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(xe,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return Wt(j,function(r){var n="_."+r[0];t&r[1]&&!Zt(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(Be);return t?t[1].split(Le):[]}(n),r)))}function sa(e){var t=0,r=0;return function(){var i=Xr(),o=I-(i-r);if(r=i,o>0){if(++t>=O)return arguments[0]}else t=0;return e.apply(n,arguments)}}function ua(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,Na(e,r)});function Fa(e){var t=hn(e);return t.__chain__=!0,t}function Ua(e,t){return t(e)}var za=Po(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return Dn(t,e)};return!(t>1||this.__actions__.length)&&i instanceof mn&&Xo(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:Ua,args:[o],thisArg:n}),new gn(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e})):this.thru(o)});var Va=io(function(e,t,r){ft.call(e,r)?++e[r]:Nn(e,r,1)});var Ga=lo(ga),Ha=lo(ma);function Wa(e,t){return(ms(e)?Wt:Fn)(e,Bo(t,3))}function Xa(e,t){return(ms(e)?Xt:Un)(e,Bo(t,3))}var Ya=io(function(e,t,r){ft.call(e,r)?e[r].push(t):Nn(e,r,[t])});var Ka=Si(function(e,t,r){var n=-1,i="function"==typeof t,o=_s(e)?qe(e.length):[];return Fn(e,function(e){o[++n]=i?Gt(t,e,r):ni(e,t,r)}),o}),Za=io(function(e,t,r){Nn(e,r,t)});function qa(e,t){return(ms(e)?Jt:di)(e,Bo(t,3))}var Ja=io(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]});var Qa=Si(function(e,t){if(null==e)return[];var r=t.length;return r>1&&Yo(e,t[0],t[1])?t=[]:r>2&&Yo(t[0],t[1],t[2])&&(t=[t[0]]),mi(e,Hn(t,1),[])}),$a=xr||function(){return Mt.Date.now()};function es(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,To(e,E,n,n,n,n,t)}function ts(e,t){var r;if("function"!=typeof t)throw new it(a);return e=zs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=n),r}}var rs=Si(function(e,t,r){var n=v;if(r.length){var i=Tr(r,xo(rs));n|=w}return To(e,n,t,r,i)}),ns=Si(function(e,t,r){var n=v|g;if(r.length){var i=Tr(r,xo(ns));n|=w}return To(t,n,e,r,i)});function is(e,t,r){var i,o,s,u,c,f,l=0,d=!1,h=!1,p=!0;if("function"!=typeof e)throw new it(a);function v(t){var r=i,a=o;return i=o=n,l=t,u=e.apply(a,r)}function g(e){var r=e-f;return f===n||r>=t||r<0||h&&e-l>=s}function m(){var e=$a();if(g(e))return y(e);c=ia(m,function(e){var r=t-(e-f);return h?Wr(r,s-(e-l)):r}(e))}function y(e){return c=n,p&&i?v(e):(i=o=n,u)}function _(){var e=$a(),r=g(e);if(i=arguments,o=this,f=e,r){if(c===n)return function(e){return l=e,c=ia(m,t),d?v(e):u}(f);if(h)return c=ia(m,t),v(f)}return c===n&&(c=ia(m,t)),u}return t=Gs(t)||0,Os(r)&&(d=!!r.leading,s=(h="maxWait"in r)?Hr(Gs(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),_.cancel=function(){c!==n&&Zi(c),l=0,i=f=o=c=n},_.flush=function(){return c===n?u:y($a())},_}var os=Si(function(e,t){return Ln(e,1,t)}),as=Si(function(e,t,r){return Ln(e,Gs(t)||0,r)});function ss(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new it(a);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(ss.Cache||wn),r}function us(e){if("function"!=typeof e)throw new it(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ss.Cache=wn;var cs=Yi(function(e,t){var r=(t=1==t.length&&ms(t[0])?Jt(t[0],pr(Bo())):Jt(Hn(t,1),pr(Bo()))).length;return Si(function(n){for(var i=-1,o=Wr(n.length,r);++i=t}),gs=ii(function(){return arguments}())?ii:function(e){return Is(e)&&ft.call(e,"callee")&&!xt.call(e,"callee")},ms=qe.isArray,ys=Lt?pr(Lt):function(e){return Is(e)&&Qn(e)==ae};function _s(e){return null!=e&&As(e.length)&&!bs(e)}function ws(e){return Is(e)&&_s(e)}var Cs=Ur||Gu,Es=jt?pr(jt):function(e){return Is(e)&&Qn(e)==G};function Ss(e){if(!Is(e))return!1;var t=Qn(e);return t==W||t==H||"string"==typeof e.message&&"string"==typeof e.name&&!Ms(e)}function bs(e){if(!Os(e))return!1;var t=Qn(e);return t==X||t==Y||t==z||t==Q}function Ts(e){return"number"==typeof e&&e==zs(e)}function As(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=N}function Os(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Is(e){return null!=e&&"object"==typeof e}var Rs=Ft?pr(Ft):function(e){return Is(e)&&Vo(e)==K};function Ps(e){return"number"==typeof e||Is(e)&&Qn(e)==Z}function Ms(e){if(!Is(e)||Qn(e)!=J)return!1;var t=Nt(e);if(null===t)return!0;var r=ft.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&ct.call(r)==pt}var Ns=Ut?pr(Ut):function(e){return Is(e)&&Qn(e)==$};var Ds=zt?pr(zt):function(e){return Is(e)&&Vo(e)==ee};function ks(e){return"string"==typeof e||!ms(e)&&Is(e)&&Qn(e)==te}function xs(e){return"symbol"==typeof e||Is(e)&&Qn(e)==re}var Bs=Vt?pr(Vt):function(e){return Is(e)&&As(e.length)&&!!bt[Qn(e)]};var Ls=wo(li),js=wo(function(e,t){return e<=t});function Fs(e){if(!e)return[];if(_s(e))return ks(e)?Rr(e):ro(e);if(fr&&e[fr])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[fr]());var t=Vo(e);return(t==K?Sr:t==ee?Ar:hu)(e)}function Us(e){return e?(e=Gs(e))===M||e===-M?(e<0?-1:1)*D:e==e?e:0:0===e?e:0}function zs(e){var t=Us(e),r=t%1;return t==t?r?t-r:t:0}function Vs(e){return e?kn(zs(e),0,x):0}function Gs(e){if("number"==typeof e)return e;if(xs(e))return k;if(Os(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Os(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Ne,"");var r=Ge.test(e);return r||We.test(e)?It(e.slice(2),r?2:8):Ve.test(e)?k:+e}function Hs(e){return no(e,ou(e))}function Ws(e){return null==e?"":Bi(e)}var Xs=oo(function(e,t){if(Jo(t)||_s(t))no(t,iu(t),e);else for(var r in t)ft.call(t,r)&&In(e,r,t[r])}),Ys=oo(function(e,t){no(t,ou(t),e)}),Ks=oo(function(e,t,r,n){no(t,ou(t),e,n)}),Zs=oo(function(e,t,r,n){no(t,iu(t),e,n)}),qs=Po(Dn);var Js=Si(function(e,t){e=tt(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&Yo(t[0],t[1],o)&&(i=1);++r1),t}),no(e,No(e),r),n&&(r=xn(r,f|l|d,Io));for(var i=t.length;i--;)ji(r,t[i]);return r});var cu=Po(function(e,t){return null==e?{}:function(e,t){return yi(e,t,function(t,r){return eu(e,r)})}(e,t)});function fu(e,t){if(null==e)return{};var r=Jt(No(e),function(e){return[e]});return t=Bo(t),yi(e,r,function(e,r){return t(e,r[0])})}var lu=bo(iu),du=bo(ou);function hu(e){return null==e?[]:vr(e,iu(e))}var pu=co(function(e,t,r){return t=t.toLowerCase(),e+(r?vu(t):t)});function vu(e){return Su(Ws(e).toLowerCase())}function gu(e){return(e=Ws(e))&&e.replace(Ye,_r).replace(mt,"")}var mu=co(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),yu=co(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),_u=uo("toLowerCase");var wu=co(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()});var Cu=co(function(e,t,r){return e+(r?" ":"")+Su(t)});var Eu=co(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),Su=uo("toUpperCase");function bu(e,t,r){return e=Ws(e),(t=r?n:t)===n?function(e){return Ct.test(e)}(e)?function(e){return e.match(_t)||[]}(e):function(e){return e.match(je)||[]}(e):e.match(t)||[]}var Tu=Si(function(e,t){try{return Gt(e,n,t)}catch(e){return Ss(e)?e:new Qe(e)}}),Au=Po(function(e,t){return Wt(t,function(t){t=fa(t),Nn(e,t,rs(e[t],e))}),e});function Ou(e){return function(){return e}}var Iu=ho(),Ru=ho(!0);function Pu(e){return e}function Mu(e){return ui("function"==typeof e?e:xn(e,f))}var Nu=Si(function(e,t){return function(r){return ni(r,e,t)}}),Du=Si(function(e,t){return function(r){return ni(e,r,t)}});function ku(e,t,r){var n=iu(t),i=Zn(t,n);null!=r||Os(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=Zn(t,iu(t)));var o=!(Os(r)&&"chain"in r&&!r.chain),a=bs(e);return Wt(i,function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=ro(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Qt([this.value()],arguments))})}),e}function xu(){}var Bu=mo(Jt),Lu=mo(Yt),ju=mo(tr);function Fu(e){return Ko(e)?cr(fa(e)):function(e){return function(t){return qn(t,e)}}(e)}var Uu=_o(),zu=_o(!0);function Vu(){return[]}function Gu(){return!1}var Hu=go(function(e,t){return e+t},0),Wu=Eo("ceil"),Xu=go(function(e,t){return e/t},1),Yu=Eo("floor");var Ku,Zu=go(function(e,t){return e*t},1),qu=Eo("round"),Ju=go(function(e,t){return e-t},0);return hn.after=function(e,t){if("function"!=typeof t)throw new it(a);return e=zs(e),function(){if(--e<1)return t.apply(this,arguments)}},hn.ary=es,hn.assign=Xs,hn.assignIn=Ys,hn.assignInWith=Ks,hn.assignWith=Zs,hn.at=qs,hn.before=ts,hn.bind=rs,hn.bindAll=Au,hn.bindKey=ns,hn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ms(e)?e:[e]},hn.chain=Fa,hn.chunk=function(e,t,r){t=(r?Yo(e,t,r):t===n)?1:Hr(zs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=qe(Lr(i/t));oo?0:o+r),(i=i===n||i>o?o:zs(i))<0&&(i+=o),i=r>i?0:Vs(i);r>>0)?(e=Ws(e))&&("string"==typeof t||null!=t&&!Ns(t))&&!(t=Bi(t))&&Er(e)?Ki(Rr(e),0,r):e.split(t,r):[]},hn.spread=function(e,t){if("function"!=typeof e)throw new it(a);return t=null==t?0:Hr(zs(t),0),Si(function(r){var n=r[t],i=Ki(r,0,t);return n&&Qt(i,n),Gt(e,this,i)})},hn.tail=function(e){var t=null==e?0:e.length;return t?Pi(e,1,t):[]},hn.take=function(e,t,r){return e&&e.length?Pi(e,0,(t=r||t===n?1:zs(t))<0?0:t):[]},hn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?Pi(e,(t=i-(t=r||t===n?1:zs(t)))<0?0:t,i):[]},hn.takeRightWhile=function(e,t){return e&&e.length?Ui(e,Bo(t,3),!1,!0):[]},hn.takeWhile=function(e,t){return e&&e.length?Ui(e,Bo(t,3)):[]},hn.tap=function(e,t){return t(e),e},hn.throttle=function(e,t,r){var n=!0,i=!0;if("function"!=typeof e)throw new it(a);return Os(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),is(e,t,{leading:n,maxWait:t,trailing:i})},hn.thru=Ua,hn.toArray=Fs,hn.toPairs=lu,hn.toPairsIn=du,hn.toPath=function(e){return ms(e)?Jt(e,fa):xs(e)?[e]:ro(ca(Ws(e)))},hn.toPlainObject=Hs,hn.transform=function(e,t,r){var n=ms(e),i=n||Cs(e)||Bs(e);if(t=Bo(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Os(e)&&bs(o)?pn(Nt(e)):{}}return(i?Wt:Yn)(e,function(e,n,i){return t(r,e,n,i)}),r},hn.unary=function(e){return es(e,1)},hn.union=Ia,hn.unionBy=Ra,hn.unionWith=Pa,hn.uniq=function(e){return e&&e.length?Li(e):[]},hn.uniqBy=function(e,t){return e&&e.length?Li(e,Bo(t,2)):[]},hn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?Li(e,n,t):[]},hn.unset=function(e,t){return null==e||ji(e,t)},hn.unzip=Ma,hn.unzipWith=Na,hn.update=function(e,t,r){return null==e?e:Fi(e,t,Wi(r))},hn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Fi(e,t,Wi(r),i)},hn.values=hu,hn.valuesIn=function(e){return null==e?[]:vr(e,ou(e))},hn.without=Da,hn.words=bu,hn.wrap=function(e,t){return fs(Wi(t),e)},hn.xor=ka,hn.xorBy=xa,hn.xorWith=Ba,hn.zip=La,hn.zipObject=function(e,t){return Gi(e||[],t||[],In)},hn.zipObjectDeep=function(e,t){return Gi(e||[],t||[],Ai)},hn.zipWith=ja,hn.entries=lu,hn.entriesIn=du,hn.extend=Ys,hn.extendWith=Ks,ku(hn,hn),hn.add=Hu,hn.attempt=Tu,hn.camelCase=pu,hn.capitalize=vu,hn.ceil=Wu,hn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=Gs(r))==r?r:0),t!==n&&(t=(t=Gs(t))==t?t:0),kn(Gs(e),t,r)},hn.clone=function(e){return xn(e,d)},hn.cloneDeep=function(e){return xn(e,f|d)},hn.cloneDeepWith=function(e,t){return xn(e,f|d,t="function"==typeof t?t:n)},hn.cloneWith=function(e,t){return xn(e,d,t="function"==typeof t?t:n)},hn.conformsTo=function(e,t){return null==t||Bn(e,t,iu(t))},hn.deburr=gu,hn.defaultTo=function(e,t){return null==e||e!=e?t:e},hn.divide=Xu,hn.endsWith=function(e,t,r){e=Ws(e),t=Bi(t);var i=e.length,o=r=r===n?i:kn(zs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},hn.eq=hs,hn.escape=function(e){return(e=Ws(e))&&Se.test(e)?e.replace(Ce,wr):e},hn.escapeRegExp=function(e){return(e=Ws(e))&&Me.test(e)?e.replace(Pe,"\\$&"):e},hn.every=function(e,t,r){var i=ms(e)?Yt:zn;return r&&Yo(e,t,r)&&(t=n),i(e,Bo(t,3))},hn.find=Ga,hn.findIndex=ga,hn.findKey=function(e,t){return nr(e,Bo(t,3),Yn)},hn.findLast=Ha,hn.findLastIndex=ma,hn.findLastKey=function(e,t){return nr(e,Bo(t,3),Kn)},hn.floor=Yu,hn.forEach=Wa,hn.forEachRight=Xa,hn.forIn=function(e,t){return null==e?e:Wn(e,Bo(t,3),ou)},hn.forInRight=function(e,t){return null==e?e:Xn(e,Bo(t,3),ou)},hn.forOwn=function(e,t){return e&&Yn(e,Bo(t,3))},hn.forOwnRight=function(e,t){return e&&Kn(e,Bo(t,3))},hn.get=$s,hn.gt=ps,hn.gte=vs,hn.has=function(e,t){return null!=e&&Go(e,t,ei)},hn.hasIn=eu,hn.head=_a,hn.identity=Pu,hn.includes=function(e,t,r,n){e=_s(e)?e:hu(e),r=r&&!n?zs(r):0;var i=e.length;return r<0&&(r=Hr(i+r,0)),ks(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&or(e,t,r)>-1},hn.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:zs(r);return i<0&&(i=Hr(n+i,0)),or(e,t,i)},hn.inRange=function(e,t,r){return t=Us(t),r===n?(r=t,t=0):r=Us(r),function(e,t,r){return e>=Wr(t,r)&&e=-N&&e<=N},hn.isSet=Ds,hn.isString=ks,hn.isSymbol=xs,hn.isTypedArray=Bs,hn.isUndefined=function(e){return e===n},hn.isWeakMap=function(e){return Is(e)&&Vo(e)==ie},hn.isWeakSet=function(e){return Is(e)&&Qn(e)==oe},hn.join=function(e,t){return null==e?"":Vr.call(e,t)},hn.kebabCase=mu,hn.last=Sa,hn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=zs(r))<0?Hr(i+o,0):Wr(o,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):ir(e,sr,o,!0)},hn.lowerCase=yu,hn.lowerFirst=_u,hn.lt=Ls,hn.lte=js,hn.max=function(e){return e&&e.length?Vn(e,Pu,$n):n},hn.maxBy=function(e,t){return e&&e.length?Vn(e,Bo(t,2),$n):n},hn.mean=function(e){return ur(e,Pu)},hn.meanBy=function(e,t){return ur(e,Bo(t,2))},hn.min=function(e){return e&&e.length?Vn(e,Pu,li):n},hn.minBy=function(e,t){return e&&e.length?Vn(e,Bo(t,2),li):n},hn.stubArray=Vu,hn.stubFalse=Gu,hn.stubObject=function(){return{}},hn.stubString=function(){return""},hn.stubTrue=function(){return!0},hn.multiply=Zu,hn.nth=function(e,t){return e&&e.length?gi(e,zs(t)):n},hn.noConflict=function(){return Mt._===this&&(Mt._=vt),this},hn.noop=xu,hn.now=$a,hn.pad=function(e,t,r){e=Ws(e);var n=(t=zs(t))?Ir(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return yo(jr(i),r)+e+yo(Lr(i),r)},hn.padEnd=function(e,t,r){e=Ws(e);var n=(t=zs(t))?Ir(e):0;return t&&nt){var i=e;e=t,t=i}if(r||e%1||t%1){var o=Kr();return Wr(e+o*(t-e+Ot("1e-"+((o+"").length-1))),t)}return Ci(e,t)},hn.reduce=function(e,t,r){var n=ms(e)?$t:lr,i=arguments.length<3;return n(e,Bo(t,4),r,i,Fn)},hn.reduceRight=function(e,t,r){var n=ms(e)?er:lr,i=arguments.length<3;return n(e,Bo(t,4),r,i,Un)},hn.repeat=function(e,t,r){return t=(r?Yo(e,t,r):t===n)?1:zs(t),Ei(Ws(e),t)},hn.replace=function(){var e=arguments,t=Ws(e[0]);return e.length<3?t:t.replace(e[1],e[2])},hn.result=function(e,t,r){var i=-1,o=(t=Xi(t,e)).length;for(o||(o=1,e=n);++iN)return[];var r=x,n=Wr(e,x);t=Bo(t),e-=x;for(var i=hr(n,t);++r=a)return e;var u=r-Ir(i);if(u<1)return i;var c=s?Ki(s,0,u).join(""):e.slice(0,u);if(o===n)return c+i;if(s&&(u+=c.length-u),Ns(o)){if(e.slice(u).search(o)){var f,l=c;for(o.global||(o=rt(o.source,Ws(ze.exec(o))+"g")),o.lastIndex=0;f=o.exec(l);)var d=f.index;c=c.slice(0,d===n?u:d)}}else if(e.indexOf(Bi(o),u)!=u){var h=c.lastIndexOf(o);h>-1&&(c=c.slice(0,h))}return c+i},hn.unescape=function(e){return(e=Ws(e))&&Ee.test(e)?e.replace(we,Pr):e},hn.uniqueId=function(e){var t=++lt;return Ws(e)+t},hn.upperCase=Eu,hn.upperFirst=Su,hn.each=Wa,hn.eachRight=Xa,hn.first=_a,ku(hn,(Ku={},Yn(hn,function(e,t){ft.call(hn.prototype,t)||(Ku[t]=e)}),Ku),{chain:!1}),hn.VERSION="4.17.11",Wt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){hn[e].placeholder=hn}),Wt(["drop","take"],function(e,t){mn.prototype[e]=function(r){r=r===n?1:Hr(zs(r),0);var i=this.__filtered__&&!t?new mn(this):this.clone();return i.__filtered__?i.__takeCount__=Wr(r,i.__takeCount__):i.__views__.push({size:Wr(r,x),type:e+(i.__dir__<0?"Right":"")}),i},mn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Wt(["filter","map","takeWhile"],function(e,t){var r=t+1,n=r==R||3==r;mn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Bo(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),Wt(["head","last"],function(e,t){var r="take"+(t?"Right":"");mn.prototype[e]=function(){return this[r](1).value()[0]}}),Wt(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");mn.prototype[e]=function(){return this.__filtered__?new mn(this):this[r](1)}}),mn.prototype.compact=function(){return this.filter(Pu)},mn.prototype.find=function(e){return this.filter(e).head()},mn.prototype.findLast=function(e){return this.reverse().find(e)},mn.prototype.invokeMap=Si(function(e,t){return"function"==typeof e?new mn(this):this.map(function(r){return ni(r,e,t)})}),mn.prototype.reject=function(e){return this.filter(us(Bo(e)))},mn.prototype.slice=function(e,t){e=zs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new mn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=zs(t))<0?r.dropRight(-t):r.take(t-e)),r)},mn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},mn.prototype.toArray=function(){return this.take(x)},Yn(mn.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=hn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(hn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof mn,c=s[0],f=u||ms(t),l=function(e){var t=o.apply(hn,Qt([e],s));return i&&d?t[0]:t};f&&r&&"function"==typeof c&&1!=c.length&&(u=f=!1);var d=this.__chain__,h=!!this.__actions__.length,p=a&&!d,v=u&&!h;if(!a&&f){t=v?t:new mn(this);var g=e.apply(t,s);return g.__actions__.push({func:Ua,args:[l],thisArg:n}),new gn(g,d)}return p&&v?e.apply(this,s):(g=this.thru(l),p?i?g.value()[0]:g.value():g)})}),Wt(["pop","push","shift","sort","splice","unshift"],function(e){var t=ot[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);hn.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(ms(i)?i:[],e)}return this[r](function(r){return t.apply(ms(r)?r:[],e)})}}),Yn(mn.prototype,function(e,t){var r=hn[t];if(r){var n=r.name+"";(nn[n]||(nn[n]=[])).push({name:t,func:r})}}),nn[po(n,g).name]=[{name:"wrapper",func:n}],mn.prototype.clone=function(){var e=new mn(this.__wrapped__);return e.__actions__=ro(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ro(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ro(this.__views__),e},mn.prototype.reverse=function(){if(this.__filtered__){var e=new mn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},mn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=ms(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},hn.prototype.plant=function(e){for(var t,r=this;r instanceof vn;){var i=da(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},hn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof mn){var t=e;return this.__actions__.length&&(t=new mn(this)),(t=t.reverse()).__actions__.push({func:Ua,args:[Oa],thisArg:n}),new gn(t,this.__chain__)}return this.thru(Oa)},hn.prototype.toJSON=hn.prototype.valueOf=hn.prototype.value=function(){return zi(this.__wrapped__,this.__actions__)},hn.prototype.first=hn.prototype.head,fr&&(hn.prototype[fr]=function(){return this}),hn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Mt._=Mr,define(function(){return Mr})):Dt?((Dt.exports=Mr)._=Mr,Nt._=Mr):Mt._=Mr}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,t,r){!function(e){"use strict";var r,n=Object.prototype,i=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"==typeof t,f=e.regeneratorRuntime;if(f)c&&(t.exports=f);else{(f=e.regeneratorRuntime=c?t.exports:{}).wrap=w;var l="suspendedStart",d="suspendedYield",h="executing",p="completed",v={},g={};g[a]=function(){return this};var m=Object.getPrototypeOf,y=m&&m(m(M([])));y&&y!==n&&i.call(y,a)&&(g=y);var _=b.prototype=E.prototype=Object.create(g);S.prototype=_.constructor=b,b.constructor=S,b[u]=S.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,u in e||(e[u]="GeneratorFunction")),e.prototype=Object.create(_),e},f.awrap=function(e){return{__await:e}},T(A.prototype),A.prototype[s]=function(){return this},f.AsyncIterator=A,f.async=function(e,t,r,n){var i=new A(w(e,t,r,n));return f.isGeneratorFunction(t)?i:i.next().then(function(e){return e.done?e.value:i.next()})},T(_),_[u]="Generator",_[a]=function(){return this},_.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=M,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(R),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=r),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),v}}}function w(e,t,r,n){var i=t&&t.prototype instanceof E?t:E,o=Object.create(i.prototype),a=new P(n||[]);return o._invoke=function(e,t,r){var n=l;return function(i,o){if(n===h)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw o;return N()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=O(a,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var u=C(e,t,r);if("normal"===u.type){if(n=r.done?p:d,u.arg===v)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function C(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function E(){}function S(){}function b(){}function T(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function A(e){var t;this._invoke=function(r,n){function o(){return new Promise(function(t,o){!function t(r,n,o,a){var s=C(e[r],e,n);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&i.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(c).then(function(e){u.value=e,o(u)},function(e){return t("throw",e,o,a)})}a(s.arg)}(r,n,t,o)})}return t=t?t.then(o,o):o()}}function O(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,O(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var i=C(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,v;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,v):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function M(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)}),delete e.url,e.urls=i?n[0]:n,!!n.length}})}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var a=r.iceCandidatePoolSize;a>0;a--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=n.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(f.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(f.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),f.prototype.onicecandidate=null,f.prototype.onaddstream=null,f.prototype.ontrack=null,f.prototype.onremovestream=null,f.prototype.onsignalingstatechange=null,f.prototype.oniceconnectionstatechange=null,f.prototype.onconnectionstatechange=null,f.prototype.onicegatheringstatechange=null,f.prototype.onnegotiationneeded=null,f.prototype.ondatachannel=null,f.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},f.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},f.prototype.getConfiguration=function(){return this._config},f.prototype.getLocalStreams=function(){return this.localStreams},f.prototype.getRemoteStreams=function(){return this.remoteStreams},f.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport,n.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(n),n},f.prototype.addTrack=function(t,r){if(this._isClosed)throw u("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find(function(e){return e.track===t}))throw u("InvalidAccessError","Track already exists.");for(var i=0;i=15025)e.getTracks().forEach(function(t){r.addTrack(t,e)});else{var n=e.clone();e.getTracks().forEach(function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",function(e){r.enabled=e.enabled})}),n.getTracks().forEach(function(e){r.addTrack(e,n)})}},f.prototype.removeTrack=function(t){if(this._isClosed)throw u("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find(function(e){return e.rtpSender===t});if(!r)throw u("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},f.prototype.removeStream=function(e){var t=this;e.getTracks().forEach(function(e){var r=t.getSenders().find(function(t){return t.track===e});r&&t.removeTrack(r)})},f.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},f.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},f.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;i.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},f.prototype._gather=function(t,r){var i=this,o=this.transceivers[r].iceGatherer;if(!o.onlocalcandidate){var a=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,o.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),o.onlocalcandidate=function(e){if(!(i.usingBundle&&r>0)){var a=new Event("icecandidate");a.candidate={sdpMid:t,sdpMLineIndex:r};var s=e.candidate,u=!s||0===Object.keys(s).length;if(u)"new"!==o.state&&"gathering"!==o.state||(o.state="completed");else{"new"===o.state&&(o.state="gathering"),s.component=1,s.ufrag=o.getLocalParameters().usernameFragment;var c=n.writeCandidate(s);a.candidate=Object.assign(a.candidate,n.parseCandidate(c)),a.candidate.candidate=c,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var f=n.getMediaSections(i._localDescription.sdp);f[a.candidate.sdpMLineIndex]+=u?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",i._localDescription.sdp=n.getDescription(i._localDescription.sdp)+f.join("");var l=i.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==i.iceGatheringState&&(i.iceGatheringState="gathering",i._emitGatheringStateChange()),u||i._dispatchEvent("icecandidate",a),l&&(i._dispatchEvent("icecandidate",new Event("icecandidate")),i.iceGatheringState="complete",i._emitGatheringStateChange())}},e.setTimeout(function(){a.forEach(function(e){o.onlocalcandidate(e)})},0)}},f.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},f.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},f.prototype._transceive=function(e,r,i){var a=o(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(a.encodings=e.sendEncodingParameters,a.rtcp={cname:n.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(a.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(a)),i&&e.rtpReceiver&&a.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?a.encodings=e.recvEncodingParameters:a.encodings=[{}],a.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(a.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(a.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(a))},f.prototype.setLocalDescription=function(e){var t,r,i=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(u("TypeError",'Unsupported type "'+e.type+'"'));if(!a("setLocalDescription",e.type,i.signalingState)||i._isClosed)return Promise.reject(u("InvalidStateError","Can not set local "+e.type+" in state "+i.signalingState));if("offer"===e.type)t=n.splitSections(e.sdp),r=t.shift(),t.forEach(function(e,t){var r=n.parseRtpParameters(e);i.transceivers[t].localCapabilities=r}),i.transceivers.forEach(function(e,t){i._gather(e.mid,t)});else if("answer"===e.type){t=n.splitSections(i._remoteDescription.sdp),r=t.shift();var s=n.matchPrefix(r,"a=ice-lite").length>0;t.forEach(function(e,t){var a=i.transceivers[t],u=a.iceGatherer,c=a.iceTransport,f=a.dtlsTransport,l=a.localCapabilities,d=a.remoteCapabilities;if(!(n.isRejected(e)&&0===n.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var h=n.getIceParameters(e,r),p=n.getDtlsParameters(e,r);s&&(p.role="server"),i.usingBundle&&0!==t||(i._gather(a.mid,t),"new"===c.state&&c.start(u,h,s?"controlling":"controlled"),"new"===f.state&&f.start(p));var v=o(l,d);i._transceive(a,v.codecs.length>0,!1)}})}return i._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?i._updateSignalingState("have-local-offer"):i._updateSignalingState("stable"),Promise.resolve()},f.prototype.setRemoteDescription=function(i){var f=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(u("TypeError",'Unsupported type "'+i.type+'"'));if(!a("setRemoteDescription",i.type,f.signalingState)||f._isClosed)return Promise.reject(u("InvalidStateError","Can not set remote "+i.type+" in state "+f.signalingState));var l={};f.remoteStreams.forEach(function(e){l[e.id]=e});var d=[],h=n.splitSections(i.sdp),p=h.shift(),v=n.matchPrefix(p,"a=ice-lite").length>0,g=n.matchPrefix(p,"a=group:BUNDLE ").length>0;f.usingBundle=g;var m=n.matchPrefix(p,"a=ice-options:")[0];return f.canTrickleIceCandidates=!!m&&m.substr(14).split(" ").indexOf("trickle")>=0,h.forEach(function(a,u){var c=n.splitLines(a),h=n.getKind(a),m=n.isRejected(a)&&0===n.matchPrefix(a,"a=bundle-only").length,y=c[0].substr(2).split(" ")[2],_=n.getDirection(a,p),w=n.parseMsid(a),C=n.getMid(a)||n.generateIdentifier();if(m||"application"===h&&("DTLS/SCTP"===y||"UDP/DTLS/SCTP"===y))f.transceivers[u]={mid:C,kind:h,protocol:y,rejected:!0};else{var E,S,b,T,A,O,I,R,P;!m&&f.transceivers[u]&&f.transceivers[u].rejected&&(f.transceivers[u]=f._createTransceiver(h,!0));var M,N,D=n.parseRtpParameters(a);m||(M=n.getIceParameters(a,p),(N=n.getDtlsParameters(a,p)).role="client"),I=n.parseRtpEncodingParameters(a);var k=n.parseRtcpParameters(a),x=n.matchPrefix(a,"a=end-of-candidates",p).length>0,B=n.matchPrefix(a,"a=candidate:").map(function(e){return n.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===i.type||"answer"===i.type)&&!m&&g&&u>0&&f.transceivers[u]&&(f._disposeIceAndDtlsTransports(u),f.transceivers[u].iceGatherer=f.transceivers[0].iceGatherer,f.transceivers[u].iceTransport=f.transceivers[0].iceTransport,f.transceivers[u].dtlsTransport=f.transceivers[0].dtlsTransport,f.transceivers[u].rtpSender&&f.transceivers[u].rtpSender.setTransport(f.transceivers[0].dtlsTransport),f.transceivers[u].rtpReceiver&&f.transceivers[u].rtpReceiver.setTransport(f.transceivers[0].dtlsTransport)),"offer"!==i.type||m){if("answer"===i.type&&!m){S=(E=f.transceivers[u]).iceGatherer,b=E.iceTransport,T=E.dtlsTransport,A=E.rtpReceiver,O=E.sendEncodingParameters,R=E.localCapabilities,f.transceivers[u].recvEncodingParameters=I,f.transceivers[u].remoteCapabilities=D,f.transceivers[u].rtcpParameters=k,B.length&&"new"===b.state&&(!v&&!x||g&&0!==u?B.forEach(function(e){s(E.iceTransport,e)}):b.setRemoteCandidates(B)),g&&0!==u||("new"===b.state&&b.start(S,M,"controlling"),"new"===T.state&&T.start(N)),!o(E.localCapabilities,E.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&E.sendEncodingParameters[0].rtx&&delete E.sendEncodingParameters[0].rtx,f._transceive(E,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!A||"sendrecv"!==_&&"sendonly"!==_?delete E.rtpReceiver:(P=A.track,w?(l[w.stream]||(l[w.stream]=new e.MediaStream),r(P,l[w.stream]),d.push([P,A,l[w.stream]])):(l.default||(l.default=new e.MediaStream),r(P,l.default),d.push([P,A,l.default])))}}else{(E=f.transceivers[u]||f._createTransceiver(h)).mid=C,E.iceGatherer||(E.iceGatherer=f._createIceGatherer(u,g)),B.length&&"new"===E.iceTransport.state&&(!x||g&&0!==u?B.forEach(function(e){s(E.iceTransport,e)}):E.iceTransport.setRemoteCandidates(B)),R=e.RTCRtpReceiver.getCapabilities(h),t<15019&&(R.codecs=R.codecs.filter(function(e){return"rtx"!==e.name})),O=E.sendEncodingParameters||[{ssrc:1001*(2*u+2)}];var L,j=!1;if("sendrecv"===_||"sendonly"===_){if(j=!E.rtpReceiver,A=E.rtpReceiver||new e.RTCRtpReceiver(E.dtlsTransport,h),j)P=A.track,w&&"-"===w.stream||(w?(l[w.stream]||(l[w.stream]=new e.MediaStream,Object.defineProperty(l[w.stream],"id",{get:function(){return w.stream}})),Object.defineProperty(P,"id",{get:function(){return w.track}}),L=l[w.stream]):(l.default||(l.default=new e.MediaStream),L=l.default)),L&&(r(P,L),E.associatedRemoteMediaStreams.push(L)),d.push([P,A,L])}else E.rtpReceiver&&E.rtpReceiver.track&&(E.associatedRemoteMediaStreams.forEach(function(t){var r,n,i=t.getTracks().find(function(e){return e.id===E.rtpReceiver.track.id});i&&(r=i,(n=t).removeTrack(r),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:r})))}),E.associatedRemoteMediaStreams=[]);E.localCapabilities=R,E.remoteCapabilities=D,E.rtpReceiver=A,E.rtcpParameters=k,E.sendEncodingParameters=O,E.recvEncodingParameters=I,f._transceive(f.transceivers[u],!1,j)}}}),void 0===f._dtlsRole&&(f._dtlsRole="offer"===i.type?"active":"passive"),f._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?f._updateSignalingState("have-remote-offer"):f._updateSignalingState("stable"),Object.keys(l).forEach(function(t){var r=l[t];if(r.getTracks().length){if(-1===f.remoteStreams.indexOf(r)){f.remoteStreams.push(r);var n=new Event("addstream");n.stream=r,e.setTimeout(function(){f._dispatchEvent("addstream",n)})}d.forEach(function(e){var t=e[0],n=e[1];r.id===e[2].id&&c(f,t,n,[r])})}}),d.forEach(function(e){e[2]||c(f,e[0],e[1],[])}),e.setTimeout(function(){f&&f.transceivers&&f.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},f.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},f.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},f.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}},0))},f.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){t[e.iceTransport.state]++}),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},f.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){t[e.iceTransport.state]++,t[e.dtlsTransport.state]++}),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},f.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(u("InvalidStateError","Can not call createOffer after close"));var o=r.transceivers.filter(function(e){return"audio"===e.kind}).length,a=r.transceivers.filter(function(e){return"video"===e.kind}).length,s=arguments[0];if(s){if(s.mandatory||s.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==s.offerToReceiveAudio&&(o=!0===s.offerToReceiveAudio?1:!1===s.offerToReceiveAudio?0:s.offerToReceiveAudio),void 0!==s.offerToReceiveVideo&&(a=!0===s.offerToReceiveVideo?1:!1===s.offerToReceiveVideo?0:s.offerToReceiveVideo)}for(r.transceivers.forEach(function(e){"audio"===e.kind?--o<0&&(e.wantReceive=!1):"video"===e.kind&&--a<0&&(e.wantReceive=!1)});o>0||a>0;)o>0&&(r._createTransceiver("audio"),o--),a>0&&(r._createTransceiver("video"),a--);var c=n.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach(function(i,o){var a=i.track,s=i.kind,u=i.mid||n.generateIdentifier();i.mid=u,i.iceGatherer||(i.iceGatherer=r._createIceGatherer(o,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(s);t<15019&&(c.codecs=c.codecs.filter(function(e){return"rtx"!==e.name})),c.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),i.remoteCapabilities&&i.remoteCapabilities.codecs&&i.remoteCapabilities.codecs.forEach(function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)})}),c.headerExtensions.forEach(function(e){(i.remoteCapabilities&&i.remoteCapabilities.headerExtensions||[]).forEach(function(t){e.uri===t.uri&&(e.id=t.id)})});var f=i.sendEncodingParameters||[{ssrc:1001*(2*o+1)}];a&&t>=15019&&"video"===s&&!f[0].rtx&&(f[0].rtx={ssrc:f[0].ssrc+1}),i.wantReceive&&(i.rtpReceiver=new e.RTCRtpReceiver(i.dtlsTransport,s)),i.localCapabilities=c,i.sendEncodingParameters=f}),"max-compat"!==r._config.bundlePolicy&&(c+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),c+="a=ice-options:trickle\r\n",r.transceivers.forEach(function(e,t){c+=i(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),c+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,c+="a="+n.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(c+="a=end-of-candidates\r\n"))});var f=new e.RTCSessionDescription({type:"offer",sdp:c});return Promise.resolve(f)},f.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(u("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(u("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var a=n.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(a+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n";var s=n.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach(function(e,n){if(!(n+1>s)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?a+="m=application 0 DTLS/SCTP 5000\r\n":a+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?a+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(a+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(a+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var u;if(e.stream)"audio"===e.kind?u=e.stream.getAudioTracks()[0]:"video"===e.kind&&(u=e.stream.getVideoTracks()[0]),u&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var c=o(e.localCapabilities,e.remoteCapabilities);!c.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,a+=i(e,c,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(a+="a=rtcp-rsize\r\n")}});var c=new e.RTCSessionDescription({type:"answer",sdp:a});return Promise.resolve(c)},f.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(i,o){if(!r._remoteDescription)return o(u("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid)for(var c=0;c0?n.parseCandidate(e.candidate):{};if("tcp"===l.protocol&&(0===l.port||9===l.port))return i();if(l.component&&1!==l.component)return i();if((0===a||a>0&&f.iceTransport!==r.transceivers[0].iceTransport)&&!s(f.iceTransport,l))return o(u("OperationError","Can not add ICE candidate"));var d=e.candidate.trim();0===d.indexOf("a=")&&(d=d.substr(2)),(t=n.getMediaSections(r._remoteDescription.sdp))[a]+="a="+(l.type?d:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=n.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var h=0;h0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},n.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},n.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(e){return parseInt(e,10)})}},n.getMid=function(e){var t=n.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},n.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},n.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:n.matchPrefix(e+t,"a=fingerprint:").map(n.parseFingerprint)}},n.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach(function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},n.getIceParameters=function(e,t){var r=n.splitLines(e);return{usernameFragment:(r=r.concat(n.splitLines(t))).filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:r.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)}},n.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},n.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=n.splitLines(e)[0].split(" "),i=3;i0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach(function(e){r+=n.writeRtpMap(e),r+=n.writeFmtp(e),r+=n.writeRtcpFb(e)});var i=0;return t.codecs.forEach(function(e){e.maxptime>i&&(i=e.maxptime)}),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",t.headerExtensions&&t.headerExtensions.forEach(function(e){r+=n.writeExtmap(e)}),r},n.parseRtpEncodingParameters=function(e){var t,r=[],i=n.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),u=s.length>0&&s[0].ssrc,c=n.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});c.length>0&&c[0].length>1&&c[0][0]===u&&(t=c[0][1]),i.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var n={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&t&&(n.rtx={ssrc:t}),r.push(n),o&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:u,mechanism:a?"red+ulpfec":"red"},r.push(n))}}),0===r.length&&u&&r.push({ssrc:u});var f=n.matchPrefix(e,"b=");return f.length&&(f=0===f[0].indexOf("b=TIAS:")?parseInt(f[0].substr(7),10):0===f[0].indexOf("b=AS:")?1e3*parseInt(f[0].substr(5),10)*.95-16e3:void 0,r.forEach(function(e){e.maxBitrate=f})),r},n.parseRtcpParameters=function(e){var t={},r=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var i=n.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=i.length>0,t.compound=0===i.length;var o=n.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},n.parseMsid=function(e){var t,r=n.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var i=n.matchPrefix(e,"a=ssrc:").map(function(e){return n.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return i.length>0?{stream:(t=i[0].value.split(" "))[0],track:t[1]}:void 0},n.generateSessionId=function(){return Math.random().toString().substr(2,21)},n.writeSessionBoilerplate=function(e,t,r){var i=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||n.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},n.writeMediaSection=function(e,t,r,i){var o=n.writeRtpDescription(e.kind,t);if(o+=n.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=n.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+n.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+n.localCName+"\r\n"),o},n.getDirection=function(e,t){for(var r=n.splitLines(e),i=0;is?o.delay=setTimeout(function(){o.id=setInterval(a,i),a()},i-s):(o.id=setInterval(a,i),a())}else o.id=setInterval(a,i)},e._stop=function(t){var r=e._timers[t];clearInterval(r.id),clearTimeout(r.delay),delete r.id,delete r.delay},e._stopRun=function(t){var r=e.hidden(),n=e._wasHidden;if(r&&!n||!r&&n)for(var i in e._timers)e._stop(i),e._run(i,!r)},e};void 0!==t&&t.exports?t.exports=i(e("./visibility.core")):i(r.Visibility||e("./visibility.core"))}(window)},{"./visibility.core":13}],13:[function(e,t,r){var n,i,o;n=this,i=-1,o={onVisible:function(e){var t=o.isSupported();if(!t||!o.hidden())return e(),t;var r=o.change(function(t,n){o.hidden()||(o.unbind(r),e())});return r},change:function(e){if(!o.isSupported())return!1;var t=i+=1;return o._callbacks[t]=e,o._listen(),t},unbind:function(e){delete o._callbacks[e]},afterPrerendering:function(e){var t=o.isSupported();if(!t||"prerender"!=o.state())return e(),t;var r=o.change(function(t,n){"prerender"!=n&&(o.unbind(r),e())});return r},hidden:function(){return!(!o._doc.hidden&&!o._doc.webkitHidden)},state:function(){return o._doc.visibilityState||o._doc.webkitVisibilityState||"visible"},isSupported:function(){return!(!o._doc.visibilityState&&!o._doc.webkitVisibilityState)},_doc:document||{},_callbacks:{},_change:function(e){var t=o.state();for(var r in o._callbacks)o._callbacks[r].call(o._doc,e,t)},_listen:function(){if(!o._init){var e="visibilitychange";o._doc.webkitVisibilityState&&(e="webkit"+e);var t=function(){o._change.apply(o,arguments)};o._doc.addEventListener?o._doc.addEventListener(e,t):o._doc.attachEvent(e,t),o._init=!0}}},void 0!==t&&t.exports?t.exports=o:n.Visibility=o},{}],15:[function(e,t,r){(function(r){"use strict";var n=e("./adapter_factory.js");t.exports=n({window:r.window})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./adapter_factory.js":16}],16:[function(e,t,r){"use strict";var n=e("./utils");t.exports=function(t,r){var i=t&&t.window,o={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0};for(var a in r)hasOwnProperty.call(r,a)&&(o[a]=r[a]);var s=n.log,u=n.detectBrowser(i),c=e("./chrome/chrome_shim")||null,f=e("./edge/edge_shim")||null,l=e("./firefox/firefox_shim")||null,d=e("./safari/safari_shim")||null,h=e("./common_shim")||null,p={browserDetails:u,commonShim:h,extractVersion:n.extractVersion,disableLog:n.disableLog,disableWarnings:n.disableWarnings};switch(u.browser){case"chrome":if(!c||!c.shimPeerConnection||!o.shimChrome)return s("Chrome shim is not included in this adapter release."),p;s("adapter.js shimming chrome."),p.browserShim=c,h.shimCreateObjectURL(i),c.shimGetUserMedia(i),c.shimMediaStream(i),c.shimSourceObject(i),c.shimPeerConnection(i),c.shimOnTrack(i),c.shimAddTrackRemoveTrack(i),c.shimGetSendersWithDtmf(i),c.shimSenderReceiverGetStats(i),c.fixNegotiationNeeded(i),h.shimRTCIceCandidate(i),h.shimMaxMessageSize(i),h.shimSendThrowTypeError(i);break;case"firefox":if(!l||!l.shimPeerConnection||!o.shimFirefox)return s("Firefox shim is not included in this adapter release."),p;s("adapter.js shimming firefox."),p.browserShim=l,h.shimCreateObjectURL(i),l.shimGetUserMedia(i),l.shimSourceObject(i),l.shimPeerConnection(i),l.shimOnTrack(i),l.shimRemoveStream(i),l.shimSenderGetStats(i),l.shimReceiverGetStats(i),l.shimRTCDataChannel(i),h.shimRTCIceCandidate(i),h.shimMaxMessageSize(i),h.shimSendThrowTypeError(i);break;case"edge":if(!f||!f.shimPeerConnection||!o.shimEdge)return s("MS edge shim is not included in this adapter release."),p;s("adapter.js shimming edge."),p.browserShim=f,h.shimCreateObjectURL(i),f.shimGetUserMedia(i),f.shimPeerConnection(i),f.shimReplaceTrack(i),h.shimMaxMessageSize(i),h.shimSendThrowTypeError(i);break;case"safari":if(!d||!o.shimSafari)return s("Safari shim is not included in this adapter release."),p;s("adapter.js shimming safari."),p.browserShim=d,h.shimCreateObjectURL(i),d.shimRTCIceServerUrls(i),d.shimCreateOfferLegacy(i),d.shimCallbacksAPI(i),d.shimLocalStreamsAPI(i),d.shimRemoteStreamsAPI(i),d.shimTrackEventTransceiver(i),d.shimGetUserMedia(i),h.shimRTCIceCandidate(i),h.shimMaxMessageSize(i),h.shimSendThrowTypeError(i);break;default:s("Unsupported browser!")}return p}},{"./chrome/chrome_shim":17,"./common_shim":19,"./edge/edge_shim":20,"./firefox/firefox_shim":23,"./safari/safari_shim":25,"./utils":26}],26:[function(e,t,r){"use strict";var n=!0,i=!0;function o(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}t.exports={extractVersion:o,wrapPeerConnectionEvent:function(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&n(t)};return this._eventMap=this._eventMap||{},this._eventMap[n]=o,i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[r])return o.apply(this,arguments);var n=this._eventMap[r];return delete this._eventMap[r],o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}},disableLog:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(n=e,e?"adapter.js logging disabled":"adapter.js logging enabled")},disableWarnings:function(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(i=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))},log:function(){if("object"==typeof window){if(n)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},deprecated:function(e,t){i&&console.warn(e+" is deprecated, please use "+t+" instead.")},detectBrowser:function(e){var t=e&&e.navigator,r={browser:null,version:null};if(void 0===e||!e.navigator)return r.browser="Not a browser.",r;if(t.mozGetUserMedia)r.browser="firefox",r.version=o(t.userAgent,/Firefox\/(\d+)\./,1);else if(t.webkitGetUserMedia)r.browser="chrome",r.version=o(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/))r.browser="edge",r.version=o(t.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!t.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=o(t.userAgent,/AppleWebKit\/(\d+)\./,1)}return r}}},{}],25:[function(e,t,r){"use strict";var n=e("../utils");t.exports={shimLocalStreamsAPI:function(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),"getStreamById"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getStreamById=function(e){var t=null;return this._localStreams&&this._localStreams.forEach(function(r){r.id===e&&(t=r)}),this._remoteStreams&&this._remoteStreams.forEach(function(r){r.id===e&&(t=r)}),t}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),-1===this._localStreams.indexOf(e)&&this._localStreams.push(e);var r=this;e.getTracks().forEach(function(n){t.call(r,n,e)})},e.RTCPeerConnection.prototype.addTrack=function(e,r){return r&&(this._localStreams?-1===this._localStreams.indexOf(r)&&this._localStreams.push(r):this._localStreams=[r]),t.call(this,e,r)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);var t=this._localStreams.indexOf(e);if(-1!==t){this._localStreams.splice(t,1);var r=this,n=e.getTracks();this.getSenders().forEach(function(e){-1!==n.indexOf(e.track)&&r.removeTrack(e)})}})}},shimRemoteStreamsAPI:function(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){this._onaddstream&&this.removeEventListener("addstream",this._onaddstream),this.addEventListener("addstream",this._onaddstream=e)}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}})}),t.apply(e,arguments)}}},shimCallbacksAPI:function(e){if("object"==typeof e&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}},shimGetUserMedia:function(e){var t=e&&e.navigator;t.getUserMedia||(t.webkitGetUserMedia?t.getUserMedia=t.webkitGetUserMedia.bind(t):t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t)))},shimRTCIceServerUrls:function(e){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var i=[],o=0;o0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,i=arguments[0];return this.getSenders().forEach(function(e){e.track===i&&(t?n=!0:t=e)}),this.getReceivers().forEach(function(e){return e.track===i&&(r?n=!0:r=e),e.track===i}),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return a.apply(this,arguments)}}}},shimSourceObject:function(e){var t=e&&e.URL;"object"==typeof e&&(!e.HTMLMediaElement||"srcObject"in e.HTMLMediaElement.prototype||Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(e){var r=this;this._srcObject=e,this.src&&t.revokeObjectURL(this.src),e?(this.src=t.createObjectURL(e),e.addEventListener("addtrack",function(){r.src&&t.revokeObjectURL(r.src),r.src=t.createObjectURL(e)}),e.addEventListener("removetrack",function(){r.src&&t.revokeObjectURL(r.src),r.src=t.createObjectURL(e)})):this.src=""}}))},shimAddTrackRemoveTrackWithNative:function(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(t){return e._shimmedLocalStreams[t][0]})};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(function(e){if(t.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")});var n=t.getSenders();r.apply(this,arguments);var i=t.getSenders().filter(function(e){return-1===n.indexOf(e)});this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]}),i.apply(this,arguments)}},shimAddTrackRemoveTrack:function(e){var t=n.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return this.shimAddTrackRemoveTrackWithNative(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return e._reverseStreams=e._reverseStreams||{},t.map(function(t){return e._reverseStreams[t.id]})};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(r._streams=r._streams||{},r._reverseStreams=r._reverseStreams||{},t.getTracks().forEach(function(e){if(r.getSenders().find(function(t){return t.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")}),!r._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());r._streams[t.id]=n,r._reverseStreams[n.id]=t,t=n}i.apply(r,[t])};var o=e.RTCPeerConnection.prototype.removeStream;function a(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;t._streams=t._streams||{},t._reverseStreams=t._reverseStreams||{},o.apply(t,[t._streams[e.id]||e]),delete t._reverseStreams[t._streams[e.id]?t._streams[e.id].id:e.id],delete t._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n=this;if("closed"===n.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(function(e){return e===t}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(n.getSenders().find(function(e){return e.track===t}))throw new DOMException("Track already exists.","InvalidAccessError");n._streams=n._streams||{},n._reverseStreams=n._reverseStreams||{};var o=n._streams[r.id];if(o)o.addTrack(t),Promise.resolve().then(function(){n.dispatchEvent(new Event("negotiationneeded"))});else{var a=new e.MediaStream([t]);n._streams[r.id]=a,n._reverseStreams[a.id]=r,n.addStream(a)}return n.getSenders().find(function(e){return e.track===t})},["createOffer","createAnswer"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(e,[function(r){var n=a(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(e,arguments).then(function(t){return a(e,t)})}});var s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};var u=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=u.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===r.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===r))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");r._streams=r._streams||{},Object.keys(r._streams).forEach(function(n){r._streams[n].getTracks().find(function(t){return e.track===t})&&(t=r._streams[n])}),t&&(1===t.getTracks().length?r.removeStream(r._reverseStreams[t.id]):t.removeTrack(e.track),r.dispatchEvent(new Event("negotiationneeded")))}},shimPeerConnection:function(e){var t=n.detectBrowser(e);!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=function(t,r){return i("PeerConnection"),t&&t.iceTransportPolicy&&(t.iceTransports=t.iceTransportPolicy),new e.webkitRTCPeerConnection(t,r)},e.RTCPeerConnection.prototype=e.webkitRTCPeerConnection.prototype,e.webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return e.webkitRTCPeerConnection.generateCertificate}}));var r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(e,t,n){var i=this,o=arguments;if(arguments.length>0&&"function"==typeof e)return r.apply(this,arguments);if(0===r.length&&(0===arguments.length||"function"!=typeof arguments[0]))return r.apply(this,[]);var a=function(e){var t={};return e.result().forEach(function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(function(t){r[t]=e.stat(t)}),t[r.id]=r}),t},s=function(e){return new Map(Object.keys(e).map(function(t){return[t,e[t]]}))};if(arguments.length>=2){return r.apply(this,[function(e){o[1](s(a(e)))},arguments[0]])}return new Promise(function(e,t){r.apply(i,[function(t){e(s(a(t)))},t])}).then(t,n)},t.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=arguments,t=this,n=new Promise(function(n,i){r.apply(t,[e[0],n,i])});return e.length<2?n:n.then(function(){e[1].apply(null,[])},function(t){e.length>=3&&e[2].apply(null,[t])})}}),t.version<52&&["createOffer","createAnswer"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var t=1===arguments.length?arguments[0]:void 0;return new Promise(function(n,i){r.apply(e,[n,i,t])})}return r.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}});var o=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?o.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}},fixNegotiationNeeded:function(e){n.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){if("stable"===e.target.signalingState)return e})},shimGetDisplayMedia:function(e,t){"getDisplayMedia"in e.navigator||("function"==typeof t?navigator.getDisplayMedia=function(e){return t(e).then(function(t){return e.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:e.video.frameRate||3}},e.video&&(e.video.height&&(e.video.maxWidth=e.video.width),e.video.width&&(e.video.maxHeight=e.video.height)),navigator.mediaDevices.getUserMedia(e)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}},{"../utils.js":26,"./getusermedia":18}],23:[function(e,t,r){"use strict";var n=e("../utils");t.exports={shimGetUserMedia:e("./getusermedia"),shimOnTrack:function(e){"object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=e),this.addEventListener("addstream",this._ontrackpoly=function(e){e.stream.getTracks().forEach(function(t){var r=new Event("track");r.track=t,r.receiver={track:t},r.transceiver={receiver:r.receiver},r.streams=[e.stream],this.dispatchEvent(r)}.bind(this))}.bind(this))},enumerable:!0,configurable:!0}),"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},shimSourceObject:function(e){"object"==typeof e&&(!e.HTMLMediaElement||"srcObject"in e.HTMLMediaElement.prototype||Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(e){this.mozSrcObject=e}}))},shimPeerConnection:function(e){var t=n.detectBrowser(e);if("object"==typeof e&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){e.RTCPeerConnection||(e.RTCPeerConnection=function(r,n){if(t.version<38&&r&&r.iceServers){for(var i=[],o=0;o0?i=parseInt(o[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i}(arguments[0],u);s=0===c&&0===f?Number.POSITIVE_INFINITY:0===c||0===f?Math.max(c,f):Math.min(c,f);var l={};Object.defineProperty(l,"maxMessageSize",{get:function(){return s}}),this._sctp=l}return r.apply(this,arguments)}}},shimSendThrowTypeError:function(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},i.wrapPeerConnectionEvent(e,"datachannel",function(e){return r(e.channel,e.target),e})}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}}},{"./utils":26,sdp:10}],20:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./filtericeservers"),o=e("rtcpeerconnection-shim");t.exports={shimGetUserMedia:e("./getusermedia"),shimPeerConnection:function(e){var t=n.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var r=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){r.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var a=o(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=i(e.iceServers)),new a(e)},e.RTCPeerConnection.prototype=a.prototype},shimReplaceTrack:function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}}},{"../utils":26,"./filtericeservers":21,"./getusermedia":22,"rtcpeerconnection-shim":9}],18:[function(e,t,r){"use strict";var n=e("../utils.js"),i=n.log;t.exports=function(e){var t=n.detectBrowser(e),r=e&&e.navigator,o=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach(function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach(function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])})}}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},a=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=o(e.audio)}if(e&&"object"==typeof e.video){var s=e.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});var u,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?u=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(u=["front"]),u)return r.mediaDevices.enumerateDevices().then(function(t){var r=(t=t.filter(function(e){return"videoinput"===e.kind})).find(function(e){return u.some(function(t){return-1!==e.label.toLowerCase().indexOf(t)})});return!r&&t.length&&-1!==u.indexOf("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=o(e.video),i("chrome: "+JSON.stringify(e)),n(e)});e.video=o(e.video)}return i("chrome: "+JSON.stringify(e)),n(e)},s=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};r.getUserMedia=function(e,t,n){a(e,function(e){r.webkitGetUserMedia(e,t,function(e){n&&n(s(e))})})};var u=function(e){return new Promise(function(t,n){r.getUserMedia(e,t,n)})};if(r.mediaDevices||(r.mediaDevices={getUserMedia:u,enumerateDevices:function(){return new Promise(function(t){var r={audio:"audioinput",video:"videoinput"};return e.MediaStreamTrack.getSources(function(e){t(e.map(function(e){return{label:e.label,kind:r[e.kind],deviceId:e.id,groupId:""}}))})})},getSupportedConstraints:function(){return{deviceId:!0,echoCancellation:!0,facingMode:!0,frameRate:!0,height:!0,width:!0}}}),r.mediaDevices.getUserMedia){var c=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return a(e,function(e){return c(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(function(e){e.stop()}),new DOMException("","NotFoundError");return t},function(e){return Promise.reject(s(e))})})}}else r.mediaDevices.getUserMedia=function(e){return u(e)};void 0===r.mediaDevices.addEventListener&&(r.mediaDevices.addEventListener=function(){i("Dummy mediaDevices.addEventListener called.")}),void 0===r.mediaDevices.removeEventListener&&(r.mediaDevices.removeEventListener=function(){i("Dummy mediaDevices.removeEventListener called.")})}},{"../utils.js":26}],22:[function(e,t,r){"use strict";t.exports=function(e){var t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch(function(e){return Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))})}}},{}],21:[function(e,t,r){"use strict";var n=e("../utils");t.exports=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var i=e.urls||e.url;e.url&&!e.urls&&n.deprecated("RTCIceServer.url","RTCIceServer.urls");var o="string"==typeof i;return o&&(i=[i]),i=i.filter(function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!r?(r=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")}),delete e.url,e.urls=o?i[0]:i,!!i.length}})}},{"../utils":26}],24:[function(e,t,r){"use strict";var n=e("../utils"),i=n.log;t.exports=function(e){var t=n.detectBrowser(e),r=e&&e.navigator,o=e&&e.MediaStreamTrack,a=function(e){return{name:{InternalError:"NotReadableError",NotSupportedError:"TypeError",PermissionDeniedError:"NotAllowedError",SecurityError:"NotAllowedError"}[e.name]||e.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[e.message]||e.message,constraint:e.constraint,toString:function(){return this.name+(this.message&&": ")+this.message}}},s=function(e,n,o){var s=function(e){if("object"!=typeof e||e.require)return e;var t=[];return Object.keys(e).forEach(function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n=e[r]="object"==typeof e[r]?e[r]:{ideal:e[r]};if(void 0===n.min&&void 0===n.max&&void 0===n.exact||t.push(r),void 0!==n.exact&&("number"==typeof n.exact?n.min=n.max=n.exact:e[r]=n.exact,delete n.exact),void 0!==n.ideal){e.advanced=e.advanced||[];var i={};"number"==typeof n.ideal?i[r]={min:n.ideal,max:n.ideal}:i[r]=n.ideal,e.advanced.push(i),delete n.ideal,Object.keys(n).length||delete e[r]}}}),t.length&&(e.require=t),e};return e=JSON.parse(JSON.stringify(e)),t.version<38&&(i("spec: "+JSON.stringify(e)),e.audio&&(e.audio=s(e.audio)),e.video&&(e.video=s(e.video)),i("ff37: "+JSON.stringify(e))),r.mozGetUserMedia(e,n,function(e){o(a(e))})};if(r.mediaDevices||(r.mediaDevices={getUserMedia:function(e){return new Promise(function(t,r){s(e,t,r)})},addEventListener:function(){},removeEventListener:function(){}}),r.mediaDevices.enumerateDevices=r.mediaDevices.enumerateDevices||function(){return new Promise(function(e){e([{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}])})},t.version<41){var u=r.mediaDevices.enumerateDevices.bind(r.mediaDevices);r.mediaDevices.enumerateDevices=function(){return u().then(void 0,function(e){if("NotFoundError"===e.name)return[];throw e})}}if(t.version<49){var c=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return c(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(function(e){e.stop()}),new DOMException("The object can not be found here.","NotFoundError");return t},function(e){return Promise.reject(a(e))})}}if(!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var f=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},l=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"==typeof e&&"object"==typeof e.audio&&(e=JSON.parse(JSON.stringify(e)),f(e.audio,"autoGainControl","mozAutoGainControl"),f(e.audio,"noiseSuppression","mozNoiseSuppression")),l(e)},o&&o.prototype.getSettings){var d=o.prototype.getSettings;o.prototype.getSettings=function(){var e=d.apply(this,arguments);return f(e,"mozAutoGainControl","autoGainControl"),f(e,"mozNoiseSuppression","noiseSuppression"),e}}if(o&&o.prototype.applyConstraints){var h=o.prototype.applyConstraints;o.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==typeof e&&(e=JSON.parse(JSON.stringify(e)),f(e,"autoGainControl","mozAutoGainControl"),f(e,"noiseSuppression","mozNoiseSuppression")),h.apply(this,[e])}}}r.getUserMedia=function(e,i,o){if(t.version<44)return s(e,i,o);n.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(i,o)}}},{"../utils":26}],27:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});class t extends Error{constructor(e,t){super(t?`Cannot access video stream (${e}: ${t.message}).`:`Cannot access video stream (${e}).`),this.type=e,this.inner=t}}class n{constructor(e,t){this.id=e,this.name=t,this._stream=null}async start(){return this._stream=await n.wrapErrors(async()=>await navigator.mediaDevices.getUserMedia({audio:!1,video:{deviceId:{exact:this.id}}})),this._stream}stop(){if(this._stream){for(let e of this._stream.getVideoTracks())e.stop();this._stream=null}}static async getCameras(){return await n.ensureAccess(),(await navigator.mediaDevices.enumerateDevices()).filter(e=>"videoinput"===e.kind).map(e=>new n(e.deviceId,function(e){return e.replace(/\s*\([0-9a-f]+(:[0-9a-f]+)?\)\s*$/,"")||e||null}(e.label)))}static async ensureAccess(){return await n.wrapErrors(async()=>{let e=await navigator.mediaDevices.getUserMedia({video:!0});for(let t of e.getVideoTracks())t.stop()})}static async wrapErrors(r){try{return await r()}catch(r){throw r.name&&"development"!==e.env.NODE_ENV?new t(r.name,r):r}}}r.default=n}).call(this,e("_process"))},{_process:7}],28:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e("./ZxingWrapper");r.default=class{constructor(e,t,r,i,o){this.scanPeriod=i,this.refractoryPeriod=o,this.captureImage=r,this._emitter=e,this._video=t,this._active=!1,this._reader=new n.default,this._canvas=document.createElement("canvas"),this._canvas.style.display="none",this._context=this._canvas.getContext("2d")}start(){this._active=!0,t.nextTick(()=>this.doScan(!0))}stop(){this._active=!1}async scan(){return await this.doScan()}async analyze(e){let t=e.getText(),r=null;if(this.captureImage){let{videoWidth:e,videoHeight:t}=this._video;this._canvas.width=e,this._canvas.height=t,this._context.drawImage(this._video,0,0,e,t),r=this._canvas.toDataURL("image/webp",.8)}return{content:t,image:r}}async doScan(e){if(!this.camera)throw new Error("No camera set");if(e&&!this._active)return null;let r=await this._reader.decodeFromVideoElement(this._video),n=await this.analyze(r);return n&&n.content!==this._lastResult&&this._active&&(this._lastResult=n.content,this._refractoryTimeout&&clearTimeout(this._refractoryTimeout),this._refractoryTimeout=setTimeout(()=>{this._refractoryTimeout=null,this._lastResult=null},this.refractoryPeriod),t.nextTick(()=>this._emitter.emit("scan",n.content,n.image))),e&&setTimeout(()=>this.doScan(!0),this.scanPeriod),n}}}).call(this,e("_process"))},{"./ZxingWrapper":30,_process:7}],30:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e("@zxing/library");r.default=class{constructor(e){this._reader=new n.BrowserQRCodeReader(e)}reset(){let e=this._reader;e.videoElement=void 0,e.canvasElement=void 0,e.canvasElementContext=void 0,e.stop()}decodeFromVideoElement(e){return new Promise((t,r)=>{e.width&&e.height||(e.width=640,e.height=480),this.reset(),this._reader.videoElement=e,this._reader.decodeOnceWithDelay(t,r)})}}},{"@zxing/library":1}],29:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=e("./ScanProvider"),i=e("events"),o=e("visibilityjs"),a=e("fsm-as-promised");r.default=class extends i.EventEmitter{constructor(e){super(),this.video=this.configureVideo(e),this.mirror=!1!==e.mirror,this.backgroundScan=!1!==e.backgroundScan,this._continuous=!1!==e.continuous;let t=e.captureImage||!1,r=e.scanPeriod||500,i=e.refractoryPeriod||5e3;this._scanProvider=new n.default(this,this.video,t,r,i),this._fsm=this.createStateMachine(),e.camera&&(this.camera=e.camera),o.change((e,t)=>{"visible"===t?setTimeout(()=>{this._fsm.can("activate")&&this._fsm.activate()},0):!this.backgroundScan&&this._fsm.can("deactivate")&&this._fsm.deactivate()}),this.addListener("active",()=>{this.video.classList.remove("inactive"),this.video.classList.add("active")}),this.addListener("inactive",()=>{this.video.classList.remove("active"),this.video.classList.add("inactive")}),this.emit("inactive")}async scan(){return await this._scanProvider.scan()}async start(){this._fsm.can("start")?await this._fsm.start():(await this._fsm.stop(),await this._fsm.start())}async stop(){this._fsm.can("stop")&&await this._fsm.stop()}set camera(e){this._scanProvider.camera&&this._scanProvider.camera.stop(),this._scanProvider.camera=e}get camera(){return this._scanProvider.camera}set captureImage(e){this._scanProvider.captureImage=e}get captureImage(){return this._scanProvider.captureImage}set scanPeriod(e){this._scanProvider.scanPeriod=e}get scanPeriod(){return this._scanProvider.scanPeriod}set refractoryPeriod(e){this._scanProvider.refractoryPeriod=e}get refractoryPeriod(){return this._scanProvider.refractoryPeriod}set continuous(e){this._continuous=e,e&&"active"===this._fsm.current?this._scanProvider.start():this._scanProvider.stop()}get continuous(){return this._continuous}set mirror(e){this._mirror=e,e?(this.video.style.webkitTransform="scaleX(-1)",this.video.style.transform="scaleX(-1)",this.video.style.filter="FlipH"):(this.video.style.webkitTransform=null,this.video.style.transform=null,this.video.style.filter=null)}get mirror(){return this._mirror}async enableScan(){if(!this.camera)throw new Error("Camera is not defined.");let e=await this.camera.start();if(this.video.srcObject=e,this.video.play(),this._continuous){const e=()=>{this._scanProvider.start(),this.video.removeEventListener("playing",e)};this.video.addEventListener("playing",e)}}disableScan(){this.video.src="",this._scanProvider&&this._scanProvider.stop(),this.camera&&this.camera.stop()}configureVideo(e){if(e.video&&"VIDEO"!==e.video.tagName)throw new Error("Video must be a